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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronize List Box with Controls on Form 3

Status
Not open for further replies.

BxWill

MIS
Mar 30, 2009
367
US
Have a form with 15 controls at the top, a subform and a listbox at the bottom of the form. EndUser can toggle from record to record using the record selectors.

The 15 controls at the top of the main form displays the major fields in the Contact table.

The subform allows the EndUser to enter data upon contacting the customers.

The Listbox displays 6 fields for every record from the Contact table - LastName,FirstName,Phone, Address,PurchaseDate,and PurchaseAmt.

Objective: Allow the EndUser to highlight a record in the listbox and display the appropriate controls at the top for the highlighted record.

Currently, as I select each record, the controls at the top of the form are not synched. Only the Phone number changes but all of the remaining fields stay the same.

Did try to alter the bound column but still not synching the selection in the listbox with the 15 controls.


Greatly appreciate some advice as to a solution.
 
There is a list box wizard that allows you to find a record on your form based on the value selected in the list box. It creates code that is similar to:
Code:
Private Sub List13_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CustomerID] = '" & Me![List13] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Duane
Hook'D on Access
MS Access MVP
 

... or ...
Code:
[blue]Me.Recordset.FindFirst "[PrimaryKeyName]=" & Me!ListboxName.Column(0)[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Receive a data type mismatch error and the following line is highlighted;


rs.FindFirst "[CustomerID] = '" & Me![List84] & "'"


Note, CustomerID is a autonumber field with a field size of Long Integer.
 

rs.FindFirst "[CustomerID] = " & Me![List84]

no single quotes since it is not text.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top