Capture Data in at least 1 of 3 fields

NTF73

Registered User.
Local time
Today, 19:23
Joined
May 21, 2008
Messages
21
Hello,

In my customer info table I have 3 fields containing contact info, Home_Tel, Mobile and Other_Tel.

I want to create a rule on the table which will allows nulls in the individual fields but not in all 3 (forcing entry of at least 1 contact number for each record)

Is this possible in the table properties or should it be a rule in the data entry form?

Any help with either case would be much appreciated.

Thanks in advance.
 
Hello,

In my customer info table I have 3 fields containing contact info, Home_Tel, Mobile and Other_Tel.

I want to create a rule on the table which will allows nulls in the individual fields but not in all 3 (forcing entry of at least 1 contact number for each record)

Is this possible in the table properties or should it be a rule in the data entry form?

Any help with either case would be much appreciated.

Thanks in advance.

I would place the code in the Onclose option on the data entry form so that it checks to see if at least one of the three is complete.
 
Would that only work if the form was closed after the record was entered? or can you enter multiple records.

Any help with the code :)
 
Would that only work if the form was closed after the record was entered? or can you enter multiple records.

Any help with the code :)

I would put the codes in the Before Update event of the form. As soon as user moves to the next record, codes will run, poping up a warning message box advising user to enter data in one of the fields.

Mike
 
Thanks mlai,

any idea what code to use?

Thanks
 
Simple Software Solutions

Are you using a bound or unbound form?
 
Thanks mlai,

any idea what code to use?

Thanks

Please put these codes in your form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Error_Form_BeforeUpdate

If IsNull(Me.Home_Tel) And IsNull(Me.Mobile) And IsNull(Me.Other_Tel) Then
MsgBox "You must enter data in one of the contact information fields."
Cancel = True
End If

Exit_Form_BeforeUpdate:
Exit Sub
Error_Form_BeforeUpdate:
MsgBox Err.Description, vbCritical
Resume Exit_Form_BeforeUpdate
End Sub

Mike
 

Users who are viewing this thread

Back
Top Bottom