I thought I had good solution but it's not so good after all..
I have a main form that the allows users to select a Purchase Order Number from a drop down list box. That PO Number selection will pop up another form that displays all the line items from that PO.
The line items of that PO are displayed in a list box. The user selects a line item and the line item information populates fields on the main form.
This was way cool until I noticed that if the user selects/highlights the second item from the list box - it's still populating the main form with the values of the first record.
The list box on the second form is unbound...and it's source is a query of which 6 values are displayed- bound to column 1.
Currently in the double click event of the list box I had following code which successfully inserted values into a table that is used by my main form.
Private Sub LineItems_DblClick(Cancel As Integer)
Dim strSQL As String
Dim item As String
Dim PO As String
Dim PartNum As String
Dim Nomen As String
Dim DwgNum As String
Dim Qty As Integer
Dim Due As Date
Dim key As Integer
PO = Me.PONumber
PartNum = Me.PartNumber
DwgNum = Me.DrawingNumber
Nomen = Me.Nomenclature
Qty = Me.Quantity
Due = Me.DueDate
'strSQL = "UPDATE tblINCOMING_INSPECT_LOG SET PONum = '" & PO & "', PartNumber = '" & PartNum & "', Nomenclature = '" & Nomen & "', DrawingNumber = '" & DwgNum & "', QtyOrdered = " & Qty & ", DateShpDue = # " & Due & " # WHERE IncmgInspectLogID = " & updKey & " ;"
'CurrentDb.Execute strSQL, dbFailOnError
DoCmd.Close
End Sub
Am I not getting the value correctly by doing an assignment like PO = Me.PONumber?
I have a main form that the allows users to select a Purchase Order Number from a drop down list box. That PO Number selection will pop up another form that displays all the line items from that PO.
The line items of that PO are displayed in a list box. The user selects a line item and the line item information populates fields on the main form.
This was way cool until I noticed that if the user selects/highlights the second item from the list box - it's still populating the main form with the values of the first record.

The list box on the second form is unbound...and it's source is a query of which 6 values are displayed- bound to column 1.
Currently in the double click event of the list box I had following code which successfully inserted values into a table that is used by my main form.
Private Sub LineItems_DblClick(Cancel As Integer)
Dim strSQL As String
Dim item As String
Dim PO As String
Dim PartNum As String
Dim Nomen As String
Dim DwgNum As String
Dim Qty As Integer
Dim Due As Date
Dim key As Integer
PO = Me.PONumber
PartNum = Me.PartNumber
DwgNum = Me.DrawingNumber
Nomen = Me.Nomenclature
Qty = Me.Quantity
Due = Me.DueDate
'strSQL = "UPDATE tblINCOMING_INSPECT_LOG SET PONum = '" & PO & "', PartNumber = '" & PartNum & "', Nomenclature = '" & Nomen & "', DrawingNumber = '" & DwgNum & "', QtyOrdered = " & Qty & ", DateShpDue = # " & Due & " # WHERE IncmgInspectLogID = " & updKey & " ;"
'CurrentDb.Execute strSQL, dbFailOnError
DoCmd.Close
End Sub
Am I not getting the value correctly by doing an assignment like PO = Me.PONumber?