end of statement...why??

A

AngiW

Why am I getting Compile Error Expected: End of statement on this? It
highlights the first [Accrual main].

docmd.RunSQL Update [Accrual Main] Set [Accrual Main].SickAvail =
[Accrual Main]![SickAvail] + 5;


also, this is going in my startup macro...do i need to put table![accrual main]
in there instead?

tia
 
K

Ken Snell

You must enclose the SQL statement inside " characters and you use a . not a
! between the table name and the field name.

DoCmd.RunSQL "Update [Accrual Main] Set [Accrual Main].SickAvail = [Accrual
Main].[SickAvail] + 5;"
 
W

Wayne Morgan

You need to pass the SQL to the RunSQL command as a string.

docmd.RunSQL "Update [Accrual Main] Set [Accrual Main].SickAvail = [Accrual
Main]![SickAvail] + 5;"
 
T

Tim Ferguson

You need to pass the SQL to the RunSQL command as a string.

docmd.RunSQL "Update [Accrual Main] Set [Accrual Main].SickAvail =
[Accrual Main]![SickAvail] + 5;"

And of course, you get much more control using

db.Execute "UPDATE [..."

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top