Open form if box is checked

  • Thread starter Thread starter Thorson
  • Start date Start date
T

Thorson

I have a check box on my form, if the users checks that box I would like
ACCESS to open another form. I tried writing the code for this but I am not
writing it correctly:

Private Sub AddtoPurebredHerd_AfterUpdate()
DoCmd.OpenForm "frmPurebredBreedingHerd" = Me.chkAddtoPurebredHerd
End Sub
 
Thorson said:
I have a check box on my form, if the users checks that box I would like
ACCESS to open another form. I tried writing the code for this but I am
not
writing it correctly:

Private Sub AddtoPurebredHerd_AfterUpdate()
DoCmd.OpenForm "frmPurebredBreedingHerd" = Me.chkAddtoPurebredHerd
End Sub

DoCmd OpenForm is a command and cannot be assigned anything. I suspect what
you need is:

Private Sub AddtoPurebredHerd_AfterUpdate()
If Me.chkAddtoPurebredHerd Then
DoCmd.OpenForm "frmPurebredBreedingHerd"
End If
End Sub
 
I edited the code to what you have:
Private Sub AddtoPurebredHerd_AfterUpdate()
If Me.chkAddtoPurebredHerd Then
DoCmd.OpenForm "frmPurebredBreedingHerd"
End If

A "Compile Error" comes up saying "Method or data member not found"

I'm not sure what that means.
 
Back
Top