BoaterJohn
Thread Starter
- Joined
- Aug 2, 2011
- Messages
- 116
[FONT="]I have a access sample database with table A and table B. [/FONT]
[FONT="]I am trying to delete any records in table A with a matching [TicketDeliverNo] field in table B[/FONT]
[FONT="]and if [AmtPaid] field in table B >1.[/FONT]
[FONT="]I have a sub proc on the forms 'close event that will trigger a sql clauses to delete the records in table A.[/FONT]
[FONT="]However, Im getting a syntax error in the SQL statement, so the error states. I tried to no avail to fix it.[/FONT]
[FONT="]Any help is highly appreciated,[/FONT]
[FONT="]Private Sub Form_Close()
Dim strSQL As String
strSQL = "DELETE tblA.*" & _
"FROM tblA" & _
"Where tblA.[TicketDeliverNo] = tblB.[TicketDeliverNo]" & _
"And tblB.[AmtPaid]>1;"
DoCmd.RunSQL strSQL
DoCmd.Close acForm, "FRMB"
End Sub
Thank You boaterjohn[/FONT]
[FONT="]I am trying to delete any records in table A with a matching [TicketDeliverNo] field in table B[/FONT]
[FONT="]and if [AmtPaid] field in table B >1.[/FONT]
[FONT="]I have a sub proc on the forms 'close event that will trigger a sql clauses to delete the records in table A.[/FONT]
[FONT="]However, Im getting a syntax error in the SQL statement, so the error states. I tried to no avail to fix it.[/FONT]
[FONT="]Any help is highly appreciated,[/FONT]
[FONT="]Private Sub Form_Close()
Dim strSQL As String
strSQL = "DELETE tblA.*" & _
"FROM tblA" & _
"Where tblA.[TicketDeliverNo] = tblB.[TicketDeliverNo]" & _
"And tblB.[AmtPaid]>1;"
DoCmd.RunSQL strSQL
DoCmd.Close acForm, "FRMB"
End Sub
Thank You boaterjohn[/FONT]