Auto-Populate

npierson

Registered User.
Local time
Today, 08:45
Joined
May 14, 2001
Messages
42
I am trying to get a text box to auto-populate based on what value is selected in a combo box. Does anyone know how I could do this?

Any help will be greatly appreciated,

Thanks

[This message has been edited by npierson (edited 05-18-2001).]
 
On the AfterUpdate Event of the combo box:

Select Case Me.ComboBoxName

Case is = "combo box selection"
Me.FieldName = "Whatever"

Do this for as many options you have and finish with

End Select

You'll need to put the same code (copy and paste) on the OnCurrent event of the form so that if you are looking back through previous records, the field updates to what is selected in the current combobox.

HTH

DBL
 
Is there an easier way to do this since the text box is going to auto-populate with information already in the table (with the exception of entering new information). Instead of writing case statements for all of the values, couldn't I somehow just auto-populate the text box by checking what record the combo box selection is in? For example If I had:

Color /// Number
----- /// -------
Red /// One
Blue /// Two

Say Color is a combo box and I select "Red", then couldn't a text box display the corresponding value of "One" without having to make a lot (in my case, not in this one) of case statements.

As I stated before, any help will be greatly appreciated,

Thanks

[This message has been edited by npierson (edited 05-18-2001).]

[This message has been edited by npierson (edited 05-18-2001).]

[This message has been edited by npierson (edited 05-18-2001).]
 
Hi again. If it was me, this is how I would do it. I would have two tables, main table would include a numeric "colour" field. I would have a Colour lookup table which would have an autonumber field, a colour text field and the colour number field. I would create a query for my form. All the fields from the main table including the colour numeric field and the colour number field from the colour lookup table. I would create my form and then create a combo box using the wizard to look up the colours available in the colours lookup table, storing the colour autonumber in the colour numeric field in the main table. What should happen then is when you select the colour you want, that colour number should appear in the colour number field automatically.

If each colour has a set colour number then this is how I would do it.

HTH

DBL

[This message has been edited by D B Lawson (edited 05-19-2001).]
 
If the information is already stored and displayed via your combo box then why do you need to display it in a text box?
 
Lawson,

Thanks, but I'm not sure how to accomplish what you stated. Is there any way you could send a simple examle to my e-mail address? Even if you don't I appreciate you trying to help with your last reply. I really need to figure this out, and I would like to do it myself, but I simply am totally unfamiliar with this.

Thanks,

Nick
 

Users who are viewing this thread

Back
Top Bottom