J
jackle
I’d like to combine the following 2 buttons into 1 button. In addition to
that, I’d like it to NOT open the form (in the Short Sheet Compare Button) if
there is not match. That is, save the record and open the form if only there
is a match. The purpose of the save function is to error check to make sure
there is not a duplicate record.
If anyone can hazard a new code or rework this, please help. This will help
me on future projects.
SHORT SHEET COMPARE BUTTON
Private Sub btnCheckShortSheet_Click()
On Error GoTo Err_btnCheckShortSheet_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "mform_Short Sheet1 Query"
stLinkCriteria = "[WO #]=" & "'" & Me![Work Order:] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Exit_btnCheckShortSheet_Click:
Exit Sub
Err_btnCheckShortSheet_Click:
MsgBox Err.Description
Resume Exit_btnCheckShortSheet_Click
End Sub
SAVE RECORD BUTTON
Private Sub SaveRecord_Click()
On Error GoTo Err_SaveRecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_SaveRecord_Click:
Exit Sub
Err_SaveRecord_Click:
MsgBox Err.Description
Resume Exit_SaveRecord_Click
End Sub
that, I’d like it to NOT open the form (in the Short Sheet Compare Button) if
there is not match. That is, save the record and open the form if only there
is a match. The purpose of the save function is to error check to make sure
there is not a duplicate record.
If anyone can hazard a new code or rework this, please help. This will help
me on future projects.
SHORT SHEET COMPARE BUTTON
Private Sub btnCheckShortSheet_Click()
On Error GoTo Err_btnCheckShortSheet_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "mform_Short Sheet1 Query"
stLinkCriteria = "[WO #]=" & "'" & Me![Work Order:] & "'"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Exit_btnCheckShortSheet_Click:
Exit Sub
Err_btnCheckShortSheet_Click:
MsgBox Err.Description
Resume Exit_btnCheckShortSheet_Click
End Sub
SAVE RECORD BUTTON
Private Sub SaveRecord_Click()
On Error GoTo Err_SaveRecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_SaveRecord_Click:
Exit Sub
Err_SaveRecord_Click:
MsgBox Err.Description
Resume Exit_SaveRecord_Click
End Sub