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

Syntax help 1

Status
Not open for further replies.

atadbitslow

Programmer
Feb 26, 2001
301
US

Set rst = dbs.OpenRecordset("SELECT * FROM res WHERE [ID]=' & Me.ID order by [year_res] desc")

Can someone help me get this syntax right, I've tried so many different variations! Thanks-
 
Try this:

Set rst = dbs.OpenRecordset("SELECT * FROM res WHERE [ID]= " & chr(34) & Me.ID & chr(34) & " Order By [year_res] Desc")
 
Thanks, but I got an error:

"Data type mismatch in criteria expression"

The field ID is a number field--
 
Then try this:

Set rst = dbs.OpenRecordset("SELECT * FROM res WHERE [ID]= " & Me.ID & " Order By [year_res] Desc")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top