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

Problem with simple where statement using dates

Status
Not open for further replies.

fogal

Technical User
Aug 20, 2001
87
US
I get the error msg no current record with this, but works from design view of query and sql is similar to sql view in query?????

sql1 = "SELECT * FROM tblAdvPublDates WHERE (((tblAdvPublDates.LastAppear)>=#" & [Forms]![frmReports]![PublDate] & "#))"

Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(sql1, dbOpenDynaset, dbSeeChanges)

MsgBox rst(0)
 
I don't know what rst(0) would return. Try
msgbox rst!NameOfOneOfYourFields

Also, you say similar...what are the differences? I test this by putting a break point on the set rst line and in the immediate window typing
?sql1

which will return the exact sql string you're passing. Take a look at whether or not that has records.

Also, do you have a date in that control that would actually return some records in the query?

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top