Very strange problem with code

laurat

Registered User.
Local time
Today, 22:46
Joined
Mar 21, 2002
Messages
120
This has me stumped, hopefully I can explain it clearly. I have a form with 6 fields on it, 4 of those fields are required. Once all the required fields have been filled in I have a check box that should fill in (this is used later on a report that is kind of like a check list to see which forms have been complete and which haven't). So what I did was place this code on the After_Update() of each of the fields

If Not IsNull(Hunt_Sales_Order_Num) Then
If Not IsNull(Date) Then
If Not IsNull(Quantity) Then
If Not IsNull(Bill_in_Place) Then
Forms![Physical Shipment Form]![Shipped] = "Yes"
End If
End If
End If
End If

For some reason if the fields are filled in, in order the checkbox fills in after the Quantity field has been filled in and before the Bill in Place field has been filled in. However, if the fields are filled in, in any other order the check box does not fill in until after the last field has been filled in. I have no clue why this is happening. Does anyone have any ideas, or see anything wrong with my code? Thanks.
 
Basically as your code exists now, it only checks to see if ANY field is filled in.

If you want it to fill in only after every field is filled in, you must do something like:

If Not IsNull(Hunt_Sales_Order_Num) AND _
Not IsNull(Date) AND _
Not IsNull(Quantity) AND _
Not IsNull(Bill_in_Place) Then _
Forms![Physical Shipment Form]![Shipped] = "Yes"
End If

And you should probably put it on the Before Update of the form and not the fields.
 
Bear in mind that Date is a reserved word in Access. (See ACC: Reserved Words in Microsoft Access .)In the expressions above, Access will behave unpredictably when it encounters the "Date" argument. If you express it as "[Date]" that may help, but I try to avoid using reserved words as field names in tables or queries.

Jim
 

Users who are viewing this thread

Back
Top Bottom