Qry Help

Acropolis

Registered User.
Local time
Today, 22:00
Joined
Feb 18, 2013
Messages
182
Hi,

I am having problems getting the below query to work in VBA. If I remove the "LIMIT 1" from the end it works, but how can i get it to work with the LIMIT 1 in place?

Code:
Set rsCheck = db.OpenRecordset("SELECT * FROM processed_obox_Headers WHERE OboxID = " & OboxID & " AND TransmitTime BETWEEN " & Format(InstalledDate, "\#mm\/dd\/yyyy\#") & " AND " & Format(DateToCheck + 1, "\#mm\/dd\/yyyy\#") & " ORDER BY ID DESC LIMIT 1; ")
 
are you trying in MS Access?
are you trying to get only 1 record?

if so, remove the LIMIT 1.
and add to your query TOP 1, eg:

"SELECT TOP 1 * From processed_obox_Headers Where ...."
 
No, when ran in SqlYOG I get the exact result I am after, all I want is the 1 record.

But when run in Access with the "LIMIT 1" in there, the qry doesn't run, remove the LIMIT 1 and it runs absolutely fine.
 

Users who are viewing this thread

Back
Top Bottom