Keith Nichols
Registered User.
- Local time
- Today, 18:39
- Joined
- Jan 27, 2006
- Messages
- 431
New to VBA (and Access) so be gentle!
I have a short bit of code to hide a text box on a form dependant upon the contents of a combo box on the same form. It seems to work but runs the error handling and then stalls with a "Compile Error: Label not defined" message. If I mark the error handling as comments the code seems to work fine.
A quick scurry through the text books, Access VBA help, various peices of code gleaned from this site, and forum postings hasn't given me any clue as to where I am going wrong.
------------------------------------------------------------
Private Sub Form_Current()
On Error GoTo Err_Form_Current
Select Case [cbo_definite_indefinite]
Case "I"
txt_definite_contract_expiry_date.Visible = False
Case Else
txt_definite_contract_expiry_date.Visible = True
End Select
Err_Form_Current:
MsgBox Err.Description
Resume Form_Current
End Sub
------------------------------------------------------------
Incidentally, I used "Case" rather than "If/Then" as it was the first example I found to copy. Would an If/Then statement be more appropriate?
Regards,
Keith.
I have a short bit of code to hide a text box on a form dependant upon the contents of a combo box on the same form. It seems to work but runs the error handling and then stalls with a "Compile Error: Label not defined" message. If I mark the error handling as comments the code seems to work fine.
A quick scurry through the text books, Access VBA help, various peices of code gleaned from this site, and forum postings hasn't given me any clue as to where I am going wrong.
------------------------------------------------------------
Private Sub Form_Current()
On Error GoTo Err_Form_Current
Select Case [cbo_definite_indefinite]
Case "I"
txt_definite_contract_expiry_date.Visible = False
Case Else
txt_definite_contract_expiry_date.Visible = True
End Select
Err_Form_Current:
MsgBox Err.Description
Resume Form_Current
End Sub
------------------------------------------------------------
Incidentally, I used "Case" rather than "If/Then" as it was the first example I found to copy. Would an If/Then statement be more appropriate?
Regards,
Keith.