CharlieT302
Instructor
Hi Folks,
I have a primary form which contains a button that compares data in its subform to the data in another table.
Here is the code:
If DLookup("Site_ID", "tbl_Calendar_Exceptions", "Site_ID='" & Forms!frm_Copy_Order![frm_Copy_Order_Detail].Form.[Site_ID] & "'" & " AND Except_Date=#" & Forms!frm_Copy_Order![frm_Copy_Order_Detail].Form.[New_Date] & "#") Then...
At the top of the code, I have an "On Error Goto Verify" command. I keep getting the message that I have a syntax error. If I remove the error message from the Verify: line at the bottom of the screen, the If statements (I have others) do their job. However, the end of the code should return the focus to the first record. This does not happen, so the error is having an effect albeit a slight one.
By the way, I have this same code attached to the On Open event of the subform, which works flawlessly. The only diff is that the On Open code obviously does not need to reference a subform (it is the subform):
Subform (On Open code) This works without problem.
If DLookup("Site_ID", "tbl_Calendar_Exceptions", "Site_ID='" & Me![Site_ID] & "'" & " AND Except_Date=#" & Me![New_Date] & "#") Then...
Can any see a syntax error in the top code?
Thanks
I have a primary form which contains a button that compares data in its subform to the data in another table.
Here is the code:
If DLookup("Site_ID", "tbl_Calendar_Exceptions", "Site_ID='" & Forms!frm_Copy_Order![frm_Copy_Order_Detail].Form.[Site_ID] & "'" & " AND Except_Date=#" & Forms!frm_Copy_Order![frm_Copy_Order_Detail].Form.[New_Date] & "#") Then...
At the top of the code, I have an "On Error Goto Verify" command. I keep getting the message that I have a syntax error. If I remove the error message from the Verify: line at the bottom of the screen, the If statements (I have others) do their job. However, the end of the code should return the focus to the first record. This does not happen, so the error is having an effect albeit a slight one.
By the way, I have this same code attached to the On Open event of the subform, which works flawlessly. The only diff is that the On Open code obviously does not need to reference a subform (it is the subform):
Subform (On Open code) This works without problem.
If DLookup("Site_ID", "tbl_Calendar_Exceptions", "Site_ID='" & Me![Site_ID] & "'" & " AND Except_Date=#" & Me![New_Date] & "#") Then...
Can any see a syntax error in the top code?
Thanks