Solved Running SQL Update Via VBA

jo15765

Registered User.
Local time
Today, 10:30
Joined
Jun 24, 2011
Messages
130
I am trying to run this:
Code:
UPDATE tbl_test SET tbl_test.received = 'sent', tbl_test.received_Date = Date() WHERE tbl_test.received Is Null AND tbl_test.received_Date Is Null AND tbl_test.supCheck Is Not Null AND tbl_test.reasonOrdered = 'Customer Order' OR tbl_test.reasonOrdered = 'Restock' OR tbl_test.reasonOrdered = 'Employee Request'

However, I get a compile error of:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters Expected 1

Can someone fix?
 
The Date function that returns the date in the regional format when it is part of a string.

You need to use
Code:
tbl_test.received_Date = Format(Date(), "\#mm\/dd\/yyyy\#")
to format for an SQL string.
 
BTW I would recommend you cnage all those string values to numeric code to represent these values. This is faster than text particularly when generating the index on those fields

When you need the text it can be looked up. It also allows you to globally change the text without changing the stored values.
 
I will make the above suggested change, but what about the rest of the code not running as I needed/
 

Users who are viewing this thread

Back
Top Bottom