Advertisement

06.20.2008 at 07:33AM PDT, ID: 23502334
[x]
Attachment Details

Access 2003 - Populating a text field from a combo box within a sub form

Asked by jdol2949 in Access Forms, Microsoft Visual Basic.Net, Access Coding/Macros

Tags: Microsoft, Access, 2003

I currently have a main form 'frmBOMtest' that has two combo boxes.  The first filters item classes, and the second box then would show the available parts with the class selected in the first combo box.  That selection is then added to the primary key field of the sub form, so as to tag what SKU goes with the parts that are going to be selected in the subform.
My subform has 5 fields on it.  
ItemSKU (PK, hidden)
DateEntry (PK, hidden)
PartNumber (combo box)
Quantity (control source is selected to 'tblParts')
Price (which is an unbound text box, relating to a separate table called 'Item'.)
When I select the Part Number combo box, I want the Price to automatically look up a value from the 'Item' table that queries the associated price with the item selected in the combo box.  The problem I'm having is that when I use an AfterUpdate command string tied into a listbox (no row source with text boxes?), it finds the associated price, but it updates all fields in the 'Price' column with the value I just picked.  Is there a way where I can just pick the SKU, select a part in the sub form, have the price show next to that part on that row, and then move to the second row and repeat?  (for as many parts as necessary, probably up to 15 for each SKU)

here is the afterupdate snippet I was using in an attempt to populate the 'Price' field on the subform, which I'm sure is wrong, but it gives you an idea of what I'm trying to do:Start Free Trial
1:
2:
3:
Private Sub cboSelectPart_AfterUpdate()
    Me.lbxPrice.RowSource = "select [Item].[Price] from Item where ItemNmbr = '" & Me.cboSelectPart & "'"
End Sub
[+][-]06.20.2008 at 08:10AM PDT, ID: 21831957

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, Microsoft Visual Basic.Net, Access Coding/Macros
Tags: Microsoft, Access, 2003
Sign Up Now!
Solution Provided By: peter57r
Participating Experts: 2
Solution Grade: B
 
 
[+][-]06.20.2008 at 08:15AM PDT, ID: 21832010

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.20.2008 at 08:20AM PDT, ID: 21832067

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.20.2008 at 08:28AM PDT, ID: 21832134

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.20.2008 at 08:56AM PDT, ID: 21832398

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.20.2008 at 09:12AM PDT, ID: 21832563

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.20.2008 at 09:16AM PDT, ID: 21832610

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.20.2008 at 09:19AM PDT, ID: 21832629

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.20.2008 at 09:44AM PDT, ID: 21832884

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628