G
Guest
I have a "purchase order" form with a combo box named "po". This form has a
main form and two subforms. The combo box on the main form has a list of
purchase order numbers. I select a purchase order, and it populates the
following text boxes on the main form:
Purchase order
Supplier
Order Data
Contact
It also populates the two subforms with purchased items, based on the PO
number that was selected (the source is the "PO number" table).
Here's the problem:
I have another form which contains a subform. This subform is a datasheet
list of records - one record for each PO number from the PO number table. I
click on the PO field from a selected record to open the "purchase order"
form. I want the "purchase order" form to open at the selected PO number
(just as if I opened "purchase order" form manually and selected the PO
number from the combo box. Here's what I have in the subform:
Private Sub PO_1_DblClick(Cancel As Integer)
strDocName = "purchase order"
DoCmd.OpenForm strDocName, , , "po = " & PO_1
End Sub
The "purchase order" form opens fine. The Order date is correct from the
"po number" table. None of the other fields get filled out. The combo box
is empty and the "purchase order" form says "filtered" at the bottom.
I know it's grabbing the correct record, because the "podate" text field in
the form is correct for that record. How do I get the other fields to fill
in. Somehow- I think I need to get the PO combobox filled in with the
correct value because this is the combo box that drives all of the text
fileds and the two subforms.
Background on the "Purchase Order" form:
The "po" combobox looks like this:
Private Sub po_AfterUpdate()
Me!supplierID = Me![po].Column(1)
Me!suppliername = Me![po].Column(2)
Me!podate = Me![po].Column(3) -> THIS IS THE ONLY TEXT BOX THAT GETS
FILLED IN PORPERLY WITH THE Docmd.OpenForm
Me!reqd_date = Me![po].Column(4)
Me!suppliercontact = Me![po].Column(6)
End Sub
main form and two subforms. The combo box on the main form has a list of
purchase order numbers. I select a purchase order, and it populates the
following text boxes on the main form:
Purchase order
Supplier
Order Data
Contact
It also populates the two subforms with purchased items, based on the PO
number that was selected (the source is the "PO number" table).
Here's the problem:
I have another form which contains a subform. This subform is a datasheet
list of records - one record for each PO number from the PO number table. I
click on the PO field from a selected record to open the "purchase order"
form. I want the "purchase order" form to open at the selected PO number
(just as if I opened "purchase order" form manually and selected the PO
number from the combo box. Here's what I have in the subform:
Private Sub PO_1_DblClick(Cancel As Integer)
strDocName = "purchase order"
DoCmd.OpenForm strDocName, , , "po = " & PO_1
End Sub
The "purchase order" form opens fine. The Order date is correct from the
"po number" table. None of the other fields get filled out. The combo box
is empty and the "purchase order" form says "filtered" at the bottom.
I know it's grabbing the correct record, because the "podate" text field in
the form is correct for that record. How do I get the other fields to fill
in. Somehow- I think I need to get the PO combobox filled in with the
correct value because this is the combo box that drives all of the text
fileds and the two subforms.
Background on the "Purchase Order" form:
The "po" combobox looks like this:
Private Sub po_AfterUpdate()
Me!supplierID = Me![po].Column(1)
Me!suppliername = Me![po].Column(2)
Me!podate = Me![po].Column(3) -> THIS IS THE ONLY TEXT BOX THAT GETS
FILLED IN PORPERLY WITH THE Docmd.OpenForm
Me!reqd_date = Me![po].Column(4)
Me!suppliercontact = Me![po].Column(6)
End Sub