code to prevent data entrey in a field (1 Viewer)

Purdue22

Registered User.
Local time
Today, 17:15
Joined
May 11, 2001
Messages
25
I have three fields: "Technical Communicator", "Phone #", and "Fax#", and I want the user to click a button called "Add /Change Dealer Info" with these same three fields instead of entering it directly into the fields on a form. Can you supply me with the code that will throw up a message box when the user trys to enter data directly on the form telling them to use the button.
 

jstutz

Registered User.
Local time
Today, 17:15
Joined
Jan 28, 2000
Messages
80
I don't think you need code at all. In design veiw of the form, from the PROPERTIES window, lock the three fields in question (PROPERTIES -> DATA tab -> LOCKED = YES). This will lock those three fields for manually changes, but will still allow you to change the value of the controls via your VBA code under the button.

Make sense?

jamie
 

Purdue22

Registered User.
Local time
Today, 17:15
Joined
May 11, 2001
Messages
25
That works!!

thanks


Just curious, could you create a message box saying "Use the button" when a user tries to enter text.
 

jstutz

Registered User.
Local time
Today, 17:15
Joined
Jan 28, 2000
Messages
80
Sure... A quick, easy way to do it would be to use the OnChange event. When the user changed the data in one of the controls, you could use:

Me!FirstName.Undo
MsgBox "Use the button to set this value"

That would undo their changes to the textbox and pop up the msgbox telling them to set the value using the button.

jamie

PS- Note that this won't work if the field is locked b/c the user can't make any changes to the control and therefore the event won't ever fire.

[This message has been edited by jstutz (edited 07-19-2001).]
 

Purdue22

Registered User.
Local time
Today, 17:15
Joined
May 11, 2001
Messages
25
Thanks,

That will work perfectly for what I need.
 

Users who are viewing this thread

Top Bottom