Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Record For PO Combo

Status
Not open for further replies.

rmtiptoes

IS-IT--Management
Mar 30, 2004
55
US
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.

 
Hi
You need to find both fields at the same time:
Code:
rs.FindFirst "[PO Number] = '" & Me![cboPONumber] & "' AND [Barcode Number] = '" & Me![cboBarCode] & "'"

You will need a little error checking too. :)
 
That was it!!! Thank you very much! I can do the error checking. In a procedure.

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.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top