Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Data Entry

Status
Not open for further replies.

webwevers

Programmer
May 10, 2002
15
US
I have a database that has four fields, all are text box fields, I would like to make the form allow data entry into the four fields but when one is filled in the other three would not allow any data to be entered. Also I need to have one of the four fields required. Would anyone have any suggestions? Thanks for any help.
 
webwevers,

On your first textbox add code on the AfterUpdate event to diable the other textboxes.

Code:
Private Sub textbox1_AfterUpdate()
'Insert your edits (Get you started)
   If IsNull(textbox1) = True
     textbox1.BackColor = vbRed 
   Else
     Me!textbox2.Enabled = False 
     Me!textbox3.Enabled = False
     Me!textbox4.Enabled = False
  End  If

End Sub

I hope this helps..


[thumbsup2]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top