Listbox selection and subforms problems

John11

New member
Local time
Today, 13:14
Joined
Apr 10, 2005
Messages
9
Hello

I'm having trouble with with my form (frmViewCust). What I am attempting to do is create a form which shows a list of customers (from a query) and has a section with the customers details (from tblCustomers). I need it so when a certain customer from the list is selected, their details will be shown in the customer details section.

The best i could do was have the list and details as sub forms (fsubListCust an frmCustDetails). I made frmViewCust to show records from the same query as fsubListCust and create the textbox CustomerID. I successfully made it for when the CustomerID is shown, fsubCustDetails shows correctly corrisponding with the same CustomerID made. How can i make it so when a record is selected from fsubListCust, the subform will change to the same record for frmViewCust.

Alternativly I made it so the list was a list box instead of the sub form, however I still encouter the same problems. I can't make it so the record (shown in the navigational button) is changed to be the same as the record selected in the listbox.

Can anyone tell me what to do?
 
can no-one help me?
 
Hi John,
I hope this helps. It took me HOURS and more google searches than I could stand to figure it out...

Private Sub lstSearch_AfterUpdate()
Dim recToFind As Long
recToFind = Me.lstSearch.Column(0)
Me.subfrmcontact.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acGoTo, recToFind

End Sub


So, 'lstSearch' is the control name of my listbox, and its a multi column listbox based on a query thus the reference to column(0). When you select an item in the listbox, the records' corresponding data is displayed in the subform (mine is called subfrmcontact) as long as recToFind in the listbox has a match in the subform.

It is late and I hope I am being coherent.
 

Users who are viewing this thread

Back
Top Bottom