MICHELE
03-26-2002, 12:14 PM
I have a form with a subform and when users enter information into the subform sometimes they get an error message when they go from one line of the subform to the one below. It seems that after getting this message some of the information from one jobs has gone to another job and some of the information is just gone. Any ideas of what is going on?
Pat Hartman
03-26-2002, 12:20 PM
Some code you have in the form is running amuck.
MICHELE
03-27-2002, 07:08 AM
That's what I thought. I have places of code on the subform. Up until yesterday, I did not have error handling on there. Thiss is what it looks like. Are there any visible problems:
Private Sub Form_Current()
On Error GoTo Err_Event
'IF ACCTINI HAS INITIALS, SHIP TO AMT CANNOT BE CHANGED, IF IT DOESN'T HAVE INITIALS, AN AMT OF $0.00 CAN BE ADDED.
If IsNull(Me.ACCTINI) = False Then
Me.Ship_To_Amount.Enabled = False
Me.Ship_To_Amount.Locked = True
Me.Drafting_Completion.Enabled = False
Me.Drafting_Completion.Locked = True
Else
If IsNull(Me.ACCTINI) = True Then
Me.Ship_To_Amount.Enabled = True
Me.Ship_To_Amount.Locked = False
Me.Drafting_Completion.Enabled = True
Me.Drafting_Completion.Locked = False
End If
End If
If Me.Type <> "LABOR ONLY" Then
Me.Date.Enabled = False
Me.Date.Locked = True
Else
If Me.Type = "LABOR ONLY" Then
Me.Date.Enabled = True
Me.Date.Locked = False
End If
End If
Exit_Event:
Exit Sub
Err_Event:
MsgBox Err.DESCRIPTION
Resume Exit_Event
End Sub
AND
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Event
If Me.LOAD_DATE.OldValue = Me.LOAD_DATE Then
Me.COUNTLOAD = Me.COUNTLOAD
Else
Me.COUNTLOAD = Me.COUNTLOAD + 1
End If
Exit_Event:
Exit Sub
Err_Event:
MsgBox Err.DESCRIPTION
Resume Exit_Event
End Sub
Please let me know if anyone reading this sees problems.
Thank You!
Fizzio
03-27-2002, 07:58 AM
At first glances,
If Me.Type <> "LABOR ONLY" Then
Me.Date.Enabled = False
Me.Date.Locked = True
Else
If Me.Type = "LABOR ONLY" Then
Me.Date.Enabled = True
Me.Date.Locked = False
could cause problems.
You have named a control (+/-field) 'date' which is a reserved word in access so that may be troublesome. Change the name of the control / field to txtShippingDate / ShippingDate or whatever and retry your code. This is the obvious one I've spotted http://www.access-programmers.co.uk/ubb/smile.gif!
MICHELE
03-28-2002, 03:52 AM
I totally forgot about those reserved words. I made that corrections and everything seems normal again.
Thanks!