Prevent Data Entry Base Upon Control Value

G

Guest

Please help! I am trying to validate the data select in a control. If the control in null, then I do not want the user to not be able to do anything else except select the value of the control I am checking

I can check to see if the control is null but I cannot keep the user for selecting another control on a tabbed form. How do I go about doing this? I have tried a loop and repainting the object, but nothing works

Any direction or advice will be greatly appreciated. My code is listed below

Thanks

********************************* CODE BEGINS **********************************
Dim strMsg As Strin

If IsNull(Forms![frmOne].[ControlOne]) The
Bee
MsgBox "You must make a selection", vbQuestion, "Invalid Choice

‘ Code to keep user from doing anything by making a choice

Els
‘If value is not Null, send report
Me.Refres

‘Code added here to send report to various people

DoCmd.Close acForm, "frmOne", acSaveN
End I
********************************** CODE ENDS ************************************
 
P

Pavel Romashkin

Use on Lost Focus event of the control to validate the data. If the
value is invalid, set the focus back to the same control.
I would also display a dialog message that would inform the user about
what needs to be done to avoid making them mad beyond belief when they
are unable to do anything, stuck on the same control all the time.

Pavel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top