Kamis, 23 Agustus 2018

[MS_AccessPros] Re: Select Top Query using a control on a form

 

Jim


My old friend AD Tajpal taught me there is always a way to do what you need in Access.

-Bill


---In MS_Access_Professionals@yahoogroups.com, <luvmymelody@yahoo.com> wrote :

Thank You Bill. That will work great. I knew there had to be a way. all of my research stated that you could not do this.


Jim Wagner


On Monday, August 20, 2018, 3:48:56 PM MDT, wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Hi Jim


You would have to use VBA to edit the SQL of the query, but it would be very simple if you start off with a query that does not have a TOP in it to start with. Otherwise you have to read the line and somehow ferret out the number.

So you have your original query and another one that is a temporary query to hold the changed SQL


Public Function Test_code(intUserNum As Integer)
    Dim strQuery As String
    Dim qdf As QueryDef
    Dim qdfTemp As QueryDef
    Dim db As Database
    
    Set db = CurrentDb
    Set qdf = db.QueryDefs("qryCustomers")
    Set qdfTemp = db.QueryDefs("qryTemp")
    
    strSQL = qdf.SQL
    
    strSQL = Replace(strSQL, "SELECT ", "SELECT _" & intUserNum & " ")
    qdfTemp.SQL = strSQL
     Set qdf = Nothing
     Set qdfTemp = Nothing
     Set db = Nothing
    
End Function


Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <luvmymelody@yahoo.com> wrote :

Hello all,

I just found a process that my boss did on a database that allows a user to open a query in design view and then change the top values value to whatever the user wants.

Is there a way to use a control on a form to be used as the source for the Top Value instead of allowing a user into a query design?

Thank You

Jim Wagner



 

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar