AOGFADUGBA
Board Regular
- Joined
- Sep 30, 2015
- Messages
- 74
Hi All.
I have two action query and i want to run/open them with VBA code but nothing seems to be working. the other part of the code is working fine except the query part. Below is the code i used.
Can someone help me out???
I have two action query and i want to run/open them with VBA code but nothing seems to be working. the other part of the code is working fine except the query part. Below is the code i used.
Code:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
DoCmd.SetWarnings False
If MsgBox("This action will remove the selected record and all associated records from the Data base. This action is irreversible. Do you want to proceed?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
'DoCmd.SetWarnings False
' OpenQuery executes a saved query
' cstrQueryName is a constant with the name of an action query
[B] DoCmd.OpenQuery "DeleteAllocationfromVoteBook"[/B]
[B] DoCmd.OpenQuery "DeleteAllocationfromGHANAAIEHISTORY"[/B]
End If
Exit_cmdDelete_Click:
DoCmd.SetWarnings True
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Can someone help me out???