Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select top X

Status
Not open for further replies.

Blorf

Programmer
Dec 30, 2003
1,608
US
Hi.

Is there a way to reference a form value in the top argument in a select query, IE instead of

Select top 5 from blah blah blah

Use

Select top Forms!Myform!Myvalue blah blah blah

Thanks!
ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
If it is a stored query, look up how to modify a querydef. There should be lots of examples on this site.

An example.
thread705-1309408
 
Hi Chaz,

You can build your SQL Statement 'on the fly' in VBA?

Like this:

Code:
dim strSQL as String
strSQL = "Select top " & Forms!Myform!MyControl!Myvalue & "From Blah where blah = blah"

and then do whatever you want with the string.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
D'oh, I should have put a space in front of the "From Blah"

So it should look like this " From Blah " etc...

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top