Qry Help (1 Viewer)

Acropolis

Registered User.
Local time
Today, 11:33
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; ")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:33
Joined
May 7, 2009
Messages
19,246
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 ...."
 

Acropolis

Registered User.
Local time
Today, 11:33
Joined
Feb 18, 2013
Messages
182
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

Top Bottom