By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

joining two action buttons

P: n/a
I'm a complete vb newby and I'm trying to make one action button to
execute two different queries at the same time. I create two different
buttons with the wizard and now -i have to merge them in one single
script. Can someone help me?

Private Sub Comando17_Click()
On Error GoTo Err_Comando17_Click

Dim stDocName As String

stDocName = "Queryprelievimagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Comando17_Click:
Exit Sub

Err_Comando17_Click:
MsgBox Err.Description
Resume Exit_Comando17_Click

End Sub
-------------------------------------------------------------------------------
Private Sub Comando18_Click()
On Error GoTo Err_Comando18_Click

Dim stDocName As String

stDocName = "qryaggiornamagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Comando18_Click:
Exit Sub

Err_Comando18_Click:
MsgBox Err.Description
Resume Exit_Comando18_Click

End Sub
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Am Tue, 13 Apr 2004 08:10:44 -0700 schrieb lorenzobaldan:
I'm a complete vb newby and I'm trying to make one action button to
execute two different queries at the same time. I create two different
buttons with the wizard and now -i have to merge them in one single
script. Can someone help me?

Private Sub Comando17_Click()
On Error GoTo Err_Comando17_Click

Dim stDocName As String

stDocName = "Queryprelievimagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Comando17_Click:
Exit Sub

Err_Comando17_Click:
MsgBox Err.Description
Resume Exit_Comando17_Click

End Sub
-------------------------------------------------------------------------------
Private Sub Comando18_Click()
On Error GoTo Err_Comando18_Click

Dim stDocName As String

stDocName = "qryaggiornamagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Comando18_Click:
Exit Sub

Err_Comando18_Click:
MsgBox Err.Description
Resume Exit_Comando18_Click

End Sub


Hello,

just use one sub. Maybe in sub comando_17_click

Append the lines

stDocName = "qryaggiornamagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Your comando17_click sub should look as this
Private Sub Comando17_Click()
On Error GoTo Err_Comando17_Click

Dim stDocName As String

stDocName = "Queryprelievimagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit
stDocName = "qryaggiornamagazzino"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Comando17_Click:
Exit Sub

Err_Comando17_Click:
MsgBox Err.Description
Resume Exit_Comando17_Click

End Sub
HTH
Karpi
<fluctuat nec mergitur>

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.