Link to home
Start Free TrialLog in
Avatar of mindserve
mindserve

asked on

match CustomerID from one form to another

I have two forms in vb 6.
Both have the basic data from the recordset. The second form groups the customers by lastname, firstname on a listbox. There are also textboxes on the second form which shows the CustomerID which is the unique identifier.

What I want to do is to be able to click a button or on the name in the listbox and have that record on form 1 ( ie customers.form) to move the recordset to the correct customer so they match.

The code for the listbox on form 2 is posted
Is there a way to click on the name in the listbox and force the recordset in form 1 to match? They would need to match with the CustomerID as that is the primary key and the unique identifier, although the user does not see the customerID.
Private Sub lstContacts_Click()
    
    'Update Contact Detail data (replace null values with empty strings to prevent errors)
    With rsContacts
  .Filter = "CustomerID='" & aContactIDs(lstContacts.ListIndex) & "'"
   
        txtTitle.Text = myNZ(!Title, "")
        txtFirstName.Text = myNZ(!firstname, "")
        txtLastName.Text = myNZ(!lastName, "")
        txtAddress.Text = myNZ(!Address, "")
        txtCity.Text = myNZ(!City, "")
        txtState.Text = myNZ(!State, "")
        txtZIP.Text = myNZ(!ZIP, "")
        txtPhone.Text = myNZ(!Phone, "")
        txtCell.Text = myNZ(!Cell, "")
        txtCustomerID.Text = myNZ(!Customerid, "")
        
    End With
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of purquiz
purquiz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This solution ok?

If its not ok, you need to give feedback so we can help you better