Sausagefingers
Registered User.
- Local time
- Today, 21:39
- Joined
- Dec 14, 2006
- Messages
- 51
Hi,
I'm trying to write a Sub which is to display a message box should a particular field be null as a user tabs through the form. The control itself is on a subform as you can see from the supplied example code below.
I have a feeling that 'Null' is an incorrect property but I'm also uncertain about the If Then format I am using.
You may have guessed by the simplicity of my question that I'm rather new to VB. I would appreciate some guidance in order to coax this rather shy message box to appear when it's supposed to!
Thanks In Advance
'------------------------------------------------------------
' orderNumber1_Exit
'
'------------------------------------------------------------
Private Sub orderNumber1_Exit(Cancel As Integer)
On Error GoTo orderNumber1_Exit_Err
If (Forms!frm_process!frm_orderDeliveryNumbers2!orderNumber1 = Null) Then
Beep
MsgBox "Supply a valid Purchase Order Number. If no Order Number exists, select 'NONE' from the Order Number listbox.", vbInformation, "..."
DoCmd.Requery ""
orderNumber1_Exit_Exit:
Exit Sub
orderNumber1_Exit_Err:
MsgBox Error$
Resume orderNumber1_Exit_Exit
End If
End Sub
I'm trying to write a Sub which is to display a message box should a particular field be null as a user tabs through the form. The control itself is on a subform as you can see from the supplied example code below.
I have a feeling that 'Null' is an incorrect property but I'm also uncertain about the If Then format I am using.
You may have guessed by the simplicity of my question that I'm rather new to VB. I would appreciate some guidance in order to coax this rather shy message box to appear when it's supposed to!
Thanks In Advance
'------------------------------------------------------------
' orderNumber1_Exit
'
'------------------------------------------------------------
Private Sub orderNumber1_Exit(Cancel As Integer)
On Error GoTo orderNumber1_Exit_Err
If (Forms!frm_process!frm_orderDeliveryNumbers2!orderNumber1 = Null) Then
Beep
MsgBox "Supply a valid Purchase Order Number. If no Order Number exists, select 'NONE' from the Order Number listbox.", vbInformation, "..."
DoCmd.Requery ""
orderNumber1_Exit_Exit:
Exit Sub
orderNumber1_Exit_Err:
MsgBox Error$
Resume orderNumber1_Exit_Exit
End If
End Sub