Event Button

  • Thread starter spcscooter via AccessMonster.com
  • Start date
S

spcscooter via AccessMonster.com

Hello All,

I have a button I need to use in a form to run the following Append Queries

Aerial Lift Append, CPR Append, Defensive Driving Append, Flagging Append,
Forklift Append, Ladder Handling Append, and Pole Climbing Append

I am using this for the Aerial Lift Append but want to be able to add the
others at the same time.

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim stDocName As String

stDocName = "Aerial Lift Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command13_Click:
Exit Sub

Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click

End Sub

Will you help me PLEASE?!!!
 
F

fredg

Hello All,

I have a button I need to use in a form to run the following Append Queries

Aerial Lift Append, CPR Append, Defensive Driving Append, Flagging Append,
Forklift Append, Ladder Handling Append, and Pole Climbing Append

I am using this for the Aerial Lift Append but want to be able to add the
others at the same time.

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim stDocName As String

stDocName = "Aerial Lift Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command13_Click:
Exit Sub

Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click

End Sub

Will you help me PLEASE?!!!

Do you wish to get a Warning message for each query?
If Not, then use SetWarnings False

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim stDocName As String

DoCmd.SetWarnings False

stDocName = "Aerial Lift Append"
DoCmd.OpenQuery stDocName

DoEvents

stDocName = "CPR Append"
DoCmd.OpenQuery stDocName

DoEvents

etc... for each additional query

DoCmd.SetWarnings True

Exit_Command13_Click:
Exit Sub

Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click

End Sub
 
J

John Spencer

You should be able to do something like the following
Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim dbAny as DAO.Database
Set dbAny = CurrentDb()

dbAny.Execute "Aerial Lift Append", dbfailOnError
'Optional code on next line
Msgbox "Added " & dbAny.RecordsAffected & " Aerial Lift records"

dbany.Execute "CPD Append", dbfailOnError

dbAny.Execute ...



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top