a button that opens different forms

  • Thread starter Thread starter Isidore
  • Start date Start date
I

Isidore

My form ("frmContacts") has a field, "Type of Contact" that accepts
one of three possible entries: Parent, Sponsor, Vendor.

Three other forms in the database are: frmParentDetails,
frmSponsorDetails and frmVendorDetails.

I'd to place a single button on frmContacts which, when clicked, looks
at the entry in the "Type of Contact" field. If it sees "Parent",
frmParentDetails opens, if it sees "Sponsor", frmSponsorDetails opens,
if it sees "Vendor", frmVendorDetails opens.

Can anyone suggest code to make this button do that?

Thanks in advance,
Isidore
 
Try something along the lines of

Dim strFormName As String

Select Case Me!("Type of Contract")
Case "Parent"
strFormName = "frmParentDetails"
Case "Sponsor"
strFormName = "frmSponsorDetails"
Case Else
strFormName = "frmVendorDetails"
End Select

DoCmd.OpenForm strFormName

Hope This Helps
Gerald Stanley MCSD
 
Back
Top