Compile erroe

kbreiss

Registered User.
Local time
Today, 22:36
Joined
Oct 1, 2002
Messages
228
Hello,
I am receiving a compile error: Syntax Error when executing this code on my save button. The debugger highlights what I have highlighted below. Any advice would be greatly appreciated.

Private Sub Command9_Click()
On Error GoTo Command9_Click_Err

DoCmd.SetWarnings False
' Inserts into Inv_Transactions the Prod_ID of Product Added. This is so when go back to Products page it displays in the drop down
DoCmd.RunSQL "INSERT INTO INV_TRANSACTIONS ( PROD_ID )"
SELECT Products.Prod_ID "

DoCmd.SaveObject acForm, "ADD_PRODUCTS"
' Clears out form, ready for next addition.
DoCmd.GoToRecord acForm, "ADD_PRODUCTS", acNewR

Thanks,
kacy
________
Tasty_squirt
 
Last edited:
kacy,

DoCmd.SetWarnings False
' Inserts into Inv_Transactions the Prod_ID of Product Added.
' This is so when go back to Products page it displays in the
' drop down

DoCmd.RunSQL "INSERT INTO INV_TRANSACTIONS ( PROD_ID )"
SELECT Products.Prod_ID "

This line should be something like:

DoCmd.RunSQL "INSERT INTO INV_TRANSACTIONS " & _
"( PROD_ID ) SELECT Products.Prod_ID From Products " & _
"Where ..."

That is correct up to the ...

If this is a parent-child arrangement, then the child record
should have its parent ID. I think you just need to requery/
refresh the main form.

Wayne
 

Users who are viewing this thread

Back
Top Bottom