Run-time error 2424

G

Guest

I have a main form called frmBatchHeader and a tabbed form imbedded in the
main form. One of the pages in the tabbed form has a subform called
fsubLLines. Within this form I have an integer field called txtPatientNumber
its control source is lngzPatientNumber. After the user types in the
txtPatientNumber, I am attempting to enable the field txtPatientName if the
length of txtPatientNumber is equal to seven with Event Procedure in the "On
Exit" property. This code works well until I click the "Add Record" button
then I get a Run-time error 2424. Can anyone out there help me resolve this
problem? Here is the code.

Private Sub txtPatientNumber_Exit(cancel As Integer)
If (Len(Me.txtPatientNumber & "") = 7) Then
Me.txtPatientName.Enabled = True
Else
Me.txtPatientName.Enabled = False
End If
End Sub
 
R

ruralguy via AccessMonster.com

I don't believe the code you posted is the source of your error but it should
really be in the AfterUpdate event of your control rather than the Exit event.
Set your system to break on all errors and tell us which line is highlighted
by the debugger.
 
R

ruralguy via AccessMonster.com

Hmmm... did you move your code to the AfterUpdate event?

Debugger highlights "If (Len(Me.txtPatientNumber & "") = 7) Then"
I don't believe the code you posted is the source of your error but it should
really be in the AfterUpdate event of your control rather than the Exit event.
[quoted text clipped - 18 lines]
 
G

Guest

I moving the code to afterupdate and it made the error go away. Thanks RG for
your help.
 
R

ruralguy via AccessMonster.com

Glad I could help Mary.
I moving the code to afterupdate and it made the error go away. Thanks RG for
your help.
Debugger highlights "If (Len(Me.txtPatientNumber & "") = 7) Then"
[quoted text clipped - 20 lines]
 

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