Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control and Failing Ifs....

Status
Not open for further replies.

Robbo1974

Technical User
Jun 1, 2001
151
GB
I have a form with a subform. The subform holds details of products ordered, the main form details of the order. I want to make sure that my users will complete all of the fields on the main form before they complete the product details, hence ensuring that no part orders slip hrough the net. The problem is that my code does not seem to work! This runs from the AfterUpdate event of the main form:

Code:
Private Sub Form_AfterUpdate()

If [Forms]![frmContactInformation]![frmOrders1subform].Form![Date] > Int(Now()) Then
MsgBox "Order dates can not be set for the future." & vbCrLf & vbCrLf & "Please enter a valid date.", vbOKOnly + vbExclamation, "Invalid Order Date"
[Forms]![frmContactInformation]![frmOrders1subform].Form![Date].Value = Null
    
DoCmd.OpenForm "frmCalendar3"
    
End If
    
If [Forms]![frmContactInformation]![frmOrders1subform].Form![PlacedBy].Value = Null Then
MsgBox "you have not entered a name in the 'placed by' field." & vbCrLf & vbCrLf & "Please do so now.", vbOKOnly + vbExclamation, "Incomplete Order Details"
[Forms]![frmContactInformation]![frmOrders1subform].Form![PlacedBy].SetFocus
End If

If [Forms]![frmContactInformation]![frmOrders1subform].Form![CboEmployees].Value = Null Then
MsgBox "you have not selected an employee to assign the order to." & vbCrLf & vbCrLf & "Please do so now.", vbOKOnly + vbExclamation, "Incomplete Order Details"
[Forms]![frmContactInformation]![frmOrders1subform].Form![CboEmployees].Dropdown
End If

If [Forms]![frmContactInformation]![frmOrders1subform].Form![Type].Value = Null Then
MsgBox "you have not selected an order type." & vbCrLf & vbCrLf & "Please do so now.", vbOKOnly + vbExclamation, "Incomplete Order Details"
[Forms]![frmContactInformation]![frmOrders1subform].Form![Type].Dropdown
End If

End Sub

Now the bit looking at the date works fine, it's just that the est doesn't! Any ideas!!!???? I have tried replacing the .value = null bit with is null and that won't work either!

Thanks in advance!

Robbo ;-)
 
No joy there either! I have put in an error handling routine, which is detecting an error but which has no associated description or number! THis is driving me nuts! I've tried just setting the required property of the fields in the underlying table but this produces some very cryptic error messages and is [bold]less[/bold]than ideal!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top