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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value for a combobox after adding new record

Status
Not open for further replies.

EvanEC

MIS
Dec 21, 2007
1
0
0
US
I've been trying to add a default network ID into a combo box called enteredby. When someone clicks the add a new record button I want the combo box to be automatically populated with the network name of the user. Ive tried to use a stored procedure to pass the value to the combobox but I can't set the inputparameter property because the form is based off a different recordset.

To get the network name I am using:
Me.txtUser3 = Environ("UserName")

Another thing I have been trying to do is to somehow put the txt box value as the default value of the combobox when someone hits add. After switching from MDB to ADP what I had isn't working anymore because I cant reference a form directly.
 
This request is more than a month old so don't know if you're still looking for help.

What you could do is fill an invisible text box with the network userID, then, thru VBA code, change the cbobox's record source type to Value List, use the value of the invisible text box as a rowsource then requery it. But don't know what the cbo box is originally used for.

You can set a textbox to the value of the combo box by the code: txtMytextBox = cboMyCombobox.Text.

However, when this line of code executes, the focus must be on cboMyCombobox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top