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!

Populate 3 text boxes with a 3 column combo box. 2

Status
Not open for further replies.

jasonmac

Programmer
Nov 14, 2002
175
0
0
US
Hi everyone. I'm using access '97. I have a combo box that holds information about raw materials. Column 1 is ItemNo, column 2 is description, and column 3 is price per pound. When the user makes a selection I want the combo box to populate three text boxes, one for each column. Can anyone help?

Thanks,
Jason
 
Just did this myself. For the control source of the text box put in the following: =cboYourBoxName.column(1)

The number in parentheses starts at zero for your first column and increments by one for each ensuing column.

You will also need to set your column count to three.

 
I'm afraid that's not going to work bucause the control source is set to a field in a table already. I'm trying to do this to speed up data entry. Sorry that I was unclear.

Thanks again,
Jason
 
StormRyder was pushing you down the right track.....

Using the AfterUpdate event for the combo box, place the following pseudocode and modify it to your needs:

Me![ItemNoField] = Me![ComboBox].Column(0)
Me![DescriptionField] = Me![ComboBox].Column(1)
Me![PriceField] = Me![ComboBox].Column(2)

When the user selects an item in the combobox, each of the three fields will be updated....

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
I'm getting an error that says, "Object does not support this property or method." Here is the exact code I'm using

Private Sub cboMaterialID_AfterUpdate()
Me![MaterialID] = Me![txtMaterialID].Column(0)
Me![MaterialDescription] = _
Me![txtMaterialDescription].Column(1)
Me![PerLb] = Me![txtPerLB].Column(2)

End Sub

[MaterialID],[MaterialDescription], and [PerLb] are the control sources for the text boxes. Did I miss something?

Thanks again,
Jason
 
Please ignore my previous post. I found the obvious error and everything works like a charm. Thanks to all.

Jason
 
Hello again everyone. I have a similar situation to the above but this time I'm the combo box holds the name, phone number, and fax number of a contact. The problem is that there are many contacts and the user has to search through all of them. The table that holds the contact information also holds the company that the contact works for. Is there a way to make the combo box only show the contacts that work for the company that the user has entered on the current record?

Thanks again,
Jason
 

Thanks StormRyder
What I needed when I needed it. Star on the way.

Regards
Dave
 
I have a database with a form called Main. In the Main form there is a status field (combobox). In the status field are 3 selections - Open, Closed, ReOpened.

Also in the Main form there are 3 text fields: Opened, Closed, ReOpened

What I would like to do is select Open or Closed or ReOpened from the Status field and then the date would populate either the Opened Text field, or the Closed Text field, or the ReOpened text field.

Any ideas on how to do this?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top