Setting default value in form

helent24

Registered User.
Local time
Today, 21:09
Joined
Jan 22, 2009
Messages
16
Hi,

I have a database that several different users enter information into, via a data entry form.

One of the fields on the form is the user's name.

Presently, the users select their name from a drop down list, and they need to do this for every new record.

Is there a way to let them select their name one time when first opening the form, and then have every record default to this until they close the form?

Thanks
 
Just make a combo, using your table of names as its source and at the end of the combo wizard select to...remember for later...or similar wording as distinct from storing it in a field.

The selected name should then appear in the combo until changed or if the form is closed. Reopening the form and it will be blank.

It is like entering something in an unbound textbox
 
I am not sure how Mike375's suggestion will work if the combo box is unbound without adding VBA code to Before update event to move the vauel from the combo box to the actual (possible hidden) control.


A simple was is to set the default value in the after update event for the control.

Code:
Private Sub [b]YourControlName[/b]_AfterUpdate()
 Me.[b]YourControlName[/b].DefaultValue = Chr(34) & Me.[b]YourControlName[/b] & Chr(34)
End Sub

*** You will need to substitute YourControlName with the name of your actual control

This should work for any control that has a default value property
 
I am not sure how Mike375's suggestion will work if the combo box is unbound without adding VBA code to Before update event to move the vauel from the combo box to the actual (possible hidden) control.

I did not make any allowance for the value to be inserted into a field.
 
Thanks Mike and Hitech - I've managed to work out where to insert Hitech's bit of code, and this is now working as desired...
 

Users who are viewing this thread

Back
Top Bottom