key in all information before proceed

fleury

Registered User.
Local time
Today, 15:44
Joined
Jul 2, 2011
Messages
27
Hi all!!!!

I have a FORM now which need user to key in customer details like first name and last name, contact number and birthdate.
However, I need to ensure that the user key in all details mentioned above before he/she can save the record.
How can I do this thing??? I have no idea now and cant figure out how can I make the thing correct.

Pls give me some advice.
Thanks in advance!!
 
Something like...

On Error GoTo MyError

Dim ctl As Control

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If IsNull(ctl) Then
MsgBox ctl.Name & " is a required field, " & vbCr & _
"Please enter the required information to continue.", vbInformation, "Required Field"
ctl.BackColor = 15269887 'Pale Yellow
' Make sure you set the lost focus event
' for each textbox to set them back to default.
' Me.backcolor = vbwhite 'or 16777215
ctl.SetFocus
Cancel = True
Exit Sub
End If
End If
Next ctl
Exit Sub
MyError:
MsgBox Err.Number & vbCr & vbCr & Err.Description


I am just unsure of where to tell you to put it. Do you have a save button? Or maybe they close the form after updating the record and then you would want it on the UNLOAD event of the form?
 

Users who are viewing this thread

Back
Top Bottom