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

Syntax Error

Status
Not open for further replies.

WarrenB

Programmer
Feb 7, 2001
38
GB
Could somebody please tell me where the syntax error is in this vba statement?
(note all one line)

DoCmd.RunSQL (DELETE tab_Requisitions.[Requisition Number], tab_Requisitions.Date, tab_Requisitions.[Account Number], tab_Requisitions.[Estimated Amount] FROM tab_Requisitions WHERE (((tab_Requisitions.[Requisition Number])=[Forms]![frm_EditRequisitionRecord]![ReqNum]));)

Thanks =================
Warren Brown
wazzer@btinternet.com
=================
 
Try changing it to:

DELETE * FROM tab_Requisitions WHERE (((tab_Requisitions.[Requisition Number])=[Forms]![frm_EditRequisitionRecord]![ReqNum]));)


The delete query deletes whole records, not just fields within a record.
Maq B-)
<insert witty signature here>
 
It now says Syntax Error: Expected expression . Any ideas?
=================
Warren Brown
wazzer@btinternet.com
=================
 
My punctuation may be off. I'm not sure I included all the beginning and ending parentheses. Just change the fields to DELETE * in your original code.
Maq B-)
<insert witty signature here>
 

You need to put some quotes around the SQL statement.

DoCmd.RunSQL (&quot;DELETE * FROM tab_Requisitions WHERE tab_Requisitions.[Requisition Number]=&quot; & [Forms]![frm_EditRequisitionRecord]![ReqNum] & &quot;;&quot;)
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top