Hi All!
I am trying to use the following code to populate a form with a record.
The code allows the user to select either the barcode or the PO number to select a record and that has worked fine.
The problem is for mutliple records for a PO. If I select a PO number which has mutliple barcodes, only the barcode is updated and not the rest of the record. If I then select the barcode, I get the correct info. The combo box's query lists all of the select parms, but only returns the first record of the PO. If I select the PO, barcode, and asset number from the combo box, I get the barcode but not the rest. How do I get the rest?
Private Sub cboPONumber_AfterUpdate()
cboBarCode = cboPONumber.Column(0)
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PO Number] = '" & Me![cboPONumber] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me![ID Number].Requery
End Sub
Private Sub cboBarCode_AfterUpdate()
cboPONumber = cboBarCode.Column(1)
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Barcode Number] = '" & Me![cboBarCode] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.
I am trying to use the following code to populate a form with a record.
The code allows the user to select either the barcode or the PO number to select a record and that has worked fine.
The problem is for mutliple records for a PO. If I select a PO number which has mutliple barcodes, only the barcode is updated and not the rest of the record. If I then select the barcode, I get the correct info. The combo box's query lists all of the select parms, but only returns the first record of the PO. If I select the PO, barcode, and asset number from the combo box, I get the barcode but not the rest. How do I get the rest?
Private Sub cboPONumber_AfterUpdate()
cboBarCode = cboPONumber.Column(0)
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PO Number] = '" & Me![cboPONumber] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me![ID Number].Requery
End Sub
Private Sub cboBarCode_AfterUpdate()
cboPONumber = cboBarCode.Column(1)
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Barcode Number] = '" & Me![cboBarCode] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.