use check box to open forms

jalverson

Registered User.
Local time
Today, 13:20
Joined
Oct 27, 2004
Messages
42
I have a main form with 2 check boxes. The title of the first box is Manufacturing and the title of the second check box is Purchased. I have 2 different forms based on the titles of the check boxes. After the user checks one of the boxes, I want the user to click a command button which opens the correct form based on the box checked.

Using the On Click for the command button, I created this code, with no success:

Dim stDocName As String

If Me.Check14 = 1 Then
stDocName = "frmManufacture"
DoCmd.OpenForm stDocName
Else
If Me.Check16 = 2 Then
stDocName = "frmPurchase"
DoCmd.OpenForm stDocName
Else
stDocName = "frmError"
DoCmd.OpenForm stDocName
End If

End Sub

Thanks for helping with this problem.

Jeff
 
Have a look at the attached sample; I have assumed that you are using an option group.
 

Attachments

Have a look at the attached sample; I have assumed that you are using an option group.

Hi john

I downloaded and looked at your code. it is exactly what i needed to use thank you.

It runs perfectly when I double click in access but i would like to use this in vba when calledfrom another form. When i put the code in and try to run it I get the error:

Compile Error
Method or data member not found

It is referring to .Frame8

here is the code i used

DoCmd.OpenForm "Mainform", acNormal

Select Case Me.Frame8
Case 1
Open Form 1
Case 2
Open Form 2
Case 3
Open Form 3
Case Else
MsgBox "You did not make a selection"
End Select

Please can you help me

Many thanks

Gary
 

Users who are viewing this thread

Back
Top Bottom