Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Default Value for a combobox after adding new record

Default Value for a combobox after adding new record

Default Value for a combobox after adding new record

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.

RE: Default Value for a combobox after adding new record

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close