BarryMK
4 strings are enough
- Local time
- Today, 20:56
- Joined
- Oct 15, 2002
- Messages
- 1,349
Helo folks
I'm just trying to run a make table query from a toggle button on a form (simple enough eh?) and have tried all sorts of syntax from examples in the forum. The Access wizard gives "DoCmd.OpenQuery stDocName, acNormal, acEdit" but this doesn't work, I understand it's because it's an action query.
I've been through many posts on the subject of this command and still can't nail it. This is my best! effort but when I debug I'm getting the message "variable not defined" and tblTrans2 highlighted.
Private Sub tglClear_Click()
On Error GoTo Err_tglClear_Click
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendToTrans2", acNormal, acEdit
DoCmd.RunSQL ("SELECT tblTrans1.* INTO TBL_" & tblTrans2 & " FROM tblTrans1; GROUP BY tblTrans1.*;")
DoCmd.SetWarnings True
Exit_tglClear_Click:
Exit Sub
Err_tglClear_Click:
MsgBox Err.Description
Resume Exit_tglClear_Click
End Sub
I'm just trying to run a make table query from a toggle button on a form (simple enough eh?) and have tried all sorts of syntax from examples in the forum. The Access wizard gives "DoCmd.OpenQuery stDocName, acNormal, acEdit" but this doesn't work, I understand it's because it's an action query.
I've been through many posts on the subject of this command and still can't nail it. This is my best! effort but when I debug I'm getting the message "variable not defined" and tblTrans2 highlighted.
Private Sub tglClear_Click()
On Error GoTo Err_tglClear_Click
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendToTrans2", acNormal, acEdit
DoCmd.RunSQL ("SELECT tblTrans1.* INTO TBL_" & tblTrans2 & " FROM tblTrans1; GROUP BY tblTrans1.*;")
DoCmd.SetWarnings True
Exit_tglClear_Click:
Exit Sub
Err_tglClear_Click:
MsgBox Err.Description
Resume Exit_tglClear_Click
End Sub
Last edited: