Solved Form - Best way to prompt users that they must complete a form field

Number11

Member
Local time
Today, 18:07
Joined
Jan 29, 2020
Messages
623
Love to hear about the best way to prompt the user when they leave a field black

Message - Please Complete Customers Telephone Number! - This cant be leave blank!
 
Is it possible to have a Customer who does not have a phone? Perhaps this is not a realistic criteria.
You can check for a value in the BeforeUpdate event. You can set the control's Tag property to "Required", and issue a message as appropriate.
BUT it seems reasonable that a Customer may not have a phone.
 
Is it possible to have a Customer who does not have a phone? Perhaps this is not a realistic criteria.
You can check for a value in the BeforeUpdate event. You can set the control's Tag property to "Required", and issue a message as appropriate.
BUT it seems reasonable that a Customer may not have a phone.
Thanks no we always have a telephone number so how would i get this setup
 
sorted it using this...

Dim strSQL As String
Dim ctl As Variant

If IsNull(Me.TelephoneNo) Then

Dialog.Box "Please enter a Customer Telephone Number!", vbCritical, "Data entry error..."
Me.TelephoneNo.BorderColor = vbRed
Me.TelephoneNo.SetFocus
Exit Sub
Else
 
Is TelephoneNo dimmed as numeric??
 
Actually, that might give you an error message if the phone is empty but it DOES NOT prevent bad data from being saved. You have to stop the save from happening and so the code needs to go in the correct event as well ad including the cancel command.

I would probably also add a length check.

The code, to be effective, MUST go into the form's BeforeUpdate event. No control event will work if you are testing for existence.
Code:
If Me.TelephoneNo & "" = "" Then
    Dialog.Box "Please enter a Customer Telephone Number!", vbCritical, "Data entry error..."
    Me.TelephoneNo.BorderColor = vbRed
    Me.TelephoneNo.SetFocus
    Cancel = True         ''' this is how you stop the save
    Exit Sub
Else
    If Len(Me.TelephoneNo) < 10 Then
         .....  'simimlar to above
    End If
End If[/CODE
 

Users who are viewing this thread

Back
Top Bottom