I get by in Access without knowing any VBA, usually by copying macros I convert. I have the following simple code to open a report with the current record from a form. I would like to add some code to that procedure to run an update query. Below if the code to run the report and under that is a converted macro to run the update query. How can I join the two. Thanks
Steve
Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "rptinvoice"
strWhere = "[new invoice No]='" & Me![new invoice no] & "'"
DoCmd.OpenReport strDocName, acPreview, , strWhere
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
End Sub
_____________
Function macUpdateSubmit()
On Error GoTo macUpdateSubmit_Err
DoCmd.OpenQuery "qryUpdateSubmitted", acNormal, acEdit
macUpdateSubmit_Exit:
Exit Function
macUpdateSubmit_Err:
MsgBox Error$
Resume macUpdateSubmit_Exit
End Function
Steve
Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "rptinvoice"
strWhere = "[new invoice No]='" & Me![new invoice no] & "'"
DoCmd.OpenReport strDocName, acPreview, , strWhere
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
End Sub
_____________
Function macUpdateSubmit()
On Error GoTo macUpdateSubmit_Err
DoCmd.OpenQuery "qryUpdateSubmitted", acNormal, acEdit
macUpdateSubmit_Exit:
Exit Function
macUpdateSubmit_Err:
MsgBox Error$
Resume macUpdateSubmit_Exit
End Function