Code to look up a number if field is null

  • Thread starter Thread starter Simon
  • Start date Start date
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
 
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 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
 
Back
Top