Need help loading values

ismith

Registered User.
Local time
Today, 22:42
Joined
Dec 14, 2011
Messages
30
Hello,

Ive got a form with bound txt boxes. these look into my 'Product' Table and show the last product entered. Now ive got a search button on the same page.

When you clcik the search button a combo box appears which has in it a list of all the values in the Product table.

What i want to do is when the user clicks any value from the combo box,
the txt boxes should populate with information for the values that have been chosen.

Example:

My combo box shows 3 values, ProductID, Description and Size.
if i choose prodID 3 i want all the txt boxes to change to the infomration that is contained in that row.


Anyone know how i can do this?


Thanks...
 
Set up your Combobox using the wizard and include the Fields you need, from Left-to-Right.

If in the Combobox they appear as

Field1 Field2 Field3

the code would be
Code:
Private Sub YourComboBox_AfterUpdate()
   Me.txtField1 =  Me.YourComboBox.Column(0)
   Me.txtField2 = Me.YourComboBox.Column(1)
   Me.txtField3= Me.YourComboBox.Column(2)
End Sub
Notice that the column index is Zero-based.

Linq ;0)>
 
Ive tried it. It dont work.

My txt boxes are bound. would that make a difference?

This is how everything is.

My product table contains productid, description, category, quantity, size and price.

In my combo box im only showing the description and size.

so when one is selected how do i change all my txt boxes to contain the information of what is chosen in the combo box??

Thanks..
 
If the Textboxes are Bound you can simply retrieve the Record. This can be accomplished using the Combobox Wizard. Here's a short tutorial I give to people on the subject:

If you haven't already done so, create a form based on your Table or Query, including all the Fields you want displayed. Then simply:
  1. Add a Combobox to your Form.
  2. The Combobox Wizard will pop up
  3. Select "Find a record based on the value I selected in my combobox."
  4. From the Table/Query the Form is based on, click on the Field you're searching by (a Field that is unique for each Record) to move it to the right side.
  5. Hit Next.
  6. Size the Column appropriately.
  7. Hit Next.
  8. Name the Combobox.
  9. Hit Finish.
Now you can drop the Combobox down and scroll down to the item to search by, or you can start to enter the item, and the Combobox will "autofill" as you type. Hit <Enter> and the Record will be retrieved.

Linq ;0)>
 
Last edited:
Hi mate ive tried this aswell.

Btw the step u mention '"Find a record based on the value I selected in my combobox." Thats not in the wizard.

Ive alredy got a fomr with txtboxes for all the fields i want displayed. ive made the combo box for the table Product which has all the values i have ony my form. ive chosen all the fields to be inputted into the combo box. and creatd it.

Whem i choose a value and hit <enter> thetxt box's go empty and it say (new) in the prodid field..

Dont get y its doin that...
 
...create a form based on your Table or Query, including all the Fields you want displayed.
Linq ;0)>
If "Find a record based on the value I selected in my combobox" doesn't appear in the Wizard, you don't have your Form based on the Table or Query that you're basing your Combobox on, which is needed to make this work.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom