Hello,
I have a button that opens a form based on the jobID
e.g.
Obviously all works, however, I want to add an additional option to this open form/record button.
Criteria is:
Look at the Job# (JobNumber) field, If the JobNumber ends with an R
e.g.
then open the record with the form "ReworkF"
Otherwise open the record with the form "JobDetailF"
Thank you
I have a button that opens a form based on the jobID
e.g.
Obviously all works, however, I want to add an additional option to this open form/record button.
Criteria is:
Look at the Job# (JobNumber) field, If the JobNumber ends with an R
e.g.
then open the record with the form "ReworkF"
Otherwise open the record with the form "JobDetailF"
Code:
'------------------------------------------------------------
' Open Matching Job Details or Rework Form
'
'------------------------------------------------------------
Private Sub BtnOpenJob_Click()
On Error GoTo Err_BtnOpenJob_Click
Dim stDocName As String
Dim stLinkCriteria As String
' (Need to add this option)
' stDocName = "ReworkF" ' Open this form at linked record if JobNumber ends with "R"
stDocName = "JobDetailF" ' Otherwise open this form
stLinkCriteria = "[JobID]=" & Me![JobID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_BtnOpenJob_Click:
Exit Sub
Err_BtnOpenJob_Click:
MsgBox err.Description
Resume Exit_BtnOpenJob_Click
End Sub
Thank you
