Jacob Hilderbrand
06-11-2006, 12:10 PM
Hi
I would like to load a default value in a control on a form. The default value would change so I can't just add it to the properties of the control.
Basically what happens is the user opens a form and selects a username from a drop-down on a form, then that form will load another form whose data comes from a query showing only data for the selected user.
Now what I need to do is just make sure that the username is stored with each record that is added. So I don't want the user to be able to type in the text, I just want to autopopulate it.
Hopefully that all makes sense.
I tried some VBA, but it would not trigger (at least the way I thought it should).
Private Sub Form_BeforeInsert(Cancel As Integer)
UserName = "test"
End Sub
What I thought was when a new record was added, the textbox UserName would automatically be loaded with the text "test".
Thanks
I would like to load a default value in a control on a form. The default value would change so I can't just add it to the properties of the control.
Basically what happens is the user opens a form and selects a username from a drop-down on a form, then that form will load another form whose data comes from a query showing only data for the selected user.
Now what I need to do is just make sure that the username is stored with each record that is added. So I don't want the user to be able to type in the text, I just want to autopopulate it.
Hopefully that all makes sense.
I tried some VBA, but it would not trigger (at least the way I thought it should).
Private Sub Form_BeforeInsert(Cancel As Integer)
UserName = "test"
End Sub
What I thought was when a new record was added, the textbox UserName would automatically be loaded with the text "test".
Thanks