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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query cannot see integer value

Status
Not open for further replies.

ugly

Programmer
Jul 5, 2002
70
0
0
GB
I have set up a recordset to return a query-If I write-it works fine

Set ms = db.OpenRecordset("Select keyFK from authcomp where AuthorIDFK = 2 ", dbOpenDynaset)

If I write it like this it does'nt work
Dim holder As Integer
holder = 2
Set ms = db.OpenRecordset("Select keyFK from authcomp where AuthorIDFK = '"holder"'", dbOpenDynaset)

what is the problem with holder?
 
Does it work if you try:
Code:
Set ms = db.OpenRecordset("Select keyFK from authcomp where AuthorIDFK = " & holder & ", dbOpenDynaset)
you don't need the 's and you need the & to include a variable in a string.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
I'd use this:
Code:
Set ms = db.OpenRecordset("Select keyFK from authcomp where AuthorIDFK = " & holder, dbOpenDynaset)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
ugly . . .

[blue]HarleyQuinn[/blue] & [blue]PHV[/blue] are correct. You only need quotes for strings! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top