Click Event of a Button

S

ServiceEnvoy

I currently have a button with the following click event (which works
fine):

Private Sub Labor_Vendors_Form_Click()
On Error GoTo Err_Labor_Vendors_Form_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM_VendorsLabor"

stLinkCriteria = "[vendorID]=" & Me![VendorID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Labor_Vendors_Form_Click:
Exit Sub

Err_Labor_Vendors_Form_Click:
MsgBox Err.Description
Resume Exit_Labor_Vendors_Form_Click
End Sub

I need to modify this statement to include an if statement. If the
field named "contactsubtype" equals "labor vendor, it will open the
form called "frm_vendorsall", if not, open form called
"frm_vendorsresource". How do I incorporate this into the statement
above?
 
R

Rob Parker

Replace the line that reads:
stDocName = "FRM_VendorsLabor"

with the following:
If Me![contactsubtype] = "labor vendor" Then
stDocName = "frm_vendorsall"
Else
stDocName = "frm_vendorsresource"
End If

HTH,

Rob
 

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