I have a form with a subform, which in turn has a subform. The second subform holds details of products ordered, the first subform details of the order and the main form holds client contact data. I want to make sure that my users will complete all of the fields on the first subform before they complete the product details, hence ensuring that no incomplete orders slip through the net. I don't want to take the easy way out of setting the required property of the fields to yes, as this produces very cryptic error messages that the users will probably have a bit of trouble with, besides which it's not very professional is it? The problem is that my code does not work! This runs from the AfterUpdate event of the main form:
Now the bit looking at the date works fine, it's just that the rest doesn't! Any ideas!!!???? I have tried replacing the .value = null bit with is null and also tried .value = "" and neither of those work either!
When I put an error trap in I get an error generated, but there is no err.number or err.description - just a msgbox with a 0.
This is one of two final bugs I have to iron out before I can hand my project over and deadline day is looming quite large! Any help or advice anyone can provide would be appreciated hugely.
Thanks in advance!
Robbo ;-)
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 rest doesn't! Any ideas!!!???? I have tried replacing the .value = null bit with is null and also tried .value = "" and neither of those work either!
When I put an error trap in I get an error generated, but there is no err.number or err.description - just a msgbox with a 0.
This is one of two final bugs I have to iron out before I can hand my project over and deadline day is looming quite large! Any help or advice anyone can provide would be appreciated hugely.
Thanks in advance!
Robbo ;-)