Missing values

david.paton

Registered User.
Local time
Today, 15:24
Joined
Jun 26, 2013
Messages
338
Is there a way to make an alert go off if some data is missing for a record, when the record is opened in a form?
 
Last edited:
add code to the Current event of the form:
.private sub form_current()
If isnull(field1 + field2 + field3 + ...) then
'Msgbox " your alert"
End if
End sub
 
I tried putting this code in but it didn't work.

Private Sub Form_Current()

If IsNull(CarersFirstName) Then
'Msgbox "There is no first name for the carer"
End If

End Sub

CarersFirstName is the field name, the table name is tblCarers and the form name is frmCarers.
 
Whoops, I just realised that the message box was commented out. I got rid of the comment and it worked fine thanks.
 
If it is a subform, put the codr in the subform.
Use Me.carersfirstname or enclosed in sqr bracket.
You may also use:
If trim(me.carersfirstname & "") = "" then
Msgbox ...
End if
 
This part is not in a subform. I have several phone number fields, phone, mobile etc. I want to make an alert for when there is no contact number entered. How would I do that?
 
Then you'll need to add additional Ifs.. to the code:

If isnull([phone1]) then
Msgbox ...
[phone1].setfocus
Exit sub
End if


If isnull([phoneMobile]) then
Msgbox..
[phoneMobile].setfocus
Exit sub
End if
...
...
 

Users who are viewing this thread

Back
Top Bottom