Code to look up a number if field is null

S

Simon

On load of a form i have a txtUser field

Usally this field is Empty when frmOrder is open, if its Empty i want
code to dispaly the UserID from this form[Forms]![frmMainMenu]!
[txtUserID]

If there is is already a number in txtUser, i do not want any numbers
to be changed and just left the same


Can any one point me in the right way for code?

Thanks
 
K

Ken Snell [MVP]

Use the form's Load event to do this:

Private Sub Form_Load()
If Len(Me.txtUser.Value & "") = 0 Then Me.txtUser.Value = _
[Forms]![frmMainMenu]![txtUserID]
End Sub
 
R

rosemarie-pc

Ken Snell said:
Use the form's Load event to do this:

Private Sub Form_Load()
If Len(Me.txtUser.Value & "") = 0 Then Me.txtUser.Value = _
[Forms]![frmMainMenu]![txtUserID]
End Sub

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Simon said:
On load of a form i have a txtUser field

Usally this field is Empty when frmOrder is open, if its Empty i want
code to dispaly the UserID from this form[Forms]![frmMainMenu]!
[txtUserID]

If there is is already a number in txtUser, i do not want any numbers
to be changed and just left the same


Can any one point me in the right way for code?

Thanks
 

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