filling unbound form

J

JohnE

I have a main form with a subform on it. the subform is continuous. At the
end of each row is a small button that opens a popup form. What I need to do
is take info and fill the popup with info relating to the subform row. I am
unsure of how to do it. Here is the popup form load that I have sofar;

Private Sub Form_Load()

Dim sql As String
Dim rst As Recordset

sql = "SELECT InventoryLots.ID, InventoryLotsQ.ID AS LotsQID,
InventoryLotsQ.LotNumber, InventoryLotsQ.PartNumber, InventoryLotsQ.Revision,
InventoryLotsQ.Location, InventoryLotsQ.POChargeAccount,
InventoryLotsQ.Quantity, InventoryLots.MaterialValuePerUnit,
InventoryLots.LaborValuePerUnit"
sql = sql & " FROM InventoryLots INNER JOIN InventoryLotsQ ON
InventoryLots.ID = InventoryLotsQ.ID"
'sql = sql & " WHERE (((InventoryLots.ID)=[InventoryLotsQ].[ID]))"

Set rst = CurrentDb.OpenRecordset(sql)

rst!ID = ID
rst!LotNumber = LotSerialNumber
rst!PartNumber = PartNumber
rst!Revision = Revision
rst!Location = Location
rst!POChargeAccount = ChargeAccountJobNumber
rst!Quantity = Quantity
rst!MaterialValuePerUnit = MaterialValuePerUnit
rst!LaborValuePerUnit = LaborValuePerUnit


End Sub

You'll notice the WHERE clause is commented out. Reason being is that in
the button's click event opening the popup is this line;

DoCmd.OpenForm "zPartPriceUpdate", , , "ID=" & Me.ID

The popup was originally bound so the WHERE was placed in here but now it
cannot be and needs to have the info placed into the popup. The information
going into the popup is filtered by the ID field on the subform.

I need help in getting this to work properly. Can someone review and see
what is wrong or what I need to do?

Thanks... John
 
J

JohnE

Nevermind. I finally got it figured out. In the WHERE clause I had to use
the subform reference for the ID.
Thanks if you read this.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top