form to form VBA

2ippy

Newbie Here, Be gentle.
Local time
Today, 04:19
Joined
Nov 10, 2006
Messages
78
I'm working on the search sample in the sample database section on forum.

I have got it looking as i want and working as i want bar 1 thing.

Code:
Private Sub CustomerList_DblClick(Cancel As Integer)
Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Customers"
    
    If Me.CustomerList <> "" Then
        stLinkCriteria = "[CustomerID]=" & Me![CustomerList]
        DoCmd.OpenForm stDocName, , , stLinkCriteria ', acReadOnly
    Else
        MsgBox ("You must select a person to view")
    End If
    
End Sub

When i double click on the name i get from the search criteria in the list, it just goes to the form and doesn't show the customer i selected.
 
customerlist is the box the list from from a query appear in and then filter out with the search txt box
 
Then CustomerID has to be the Bound column in the list box unless you specify the Column you want as criteria
 
well when i click on the name in the list i chose i goto the main form filtered which don't help :(
 

Attachments

Okay, you had a couple of things wrong -

1. Remove the control source from the list box on the Customer search form. You aren't binding it, it needs to be unbound so you can select it.

2. change the bound column on the listbox to 1 (you currently have it set to 5 and you don't want the postal code as the bound column, you want the customer ID).

If you do those things, it works.
 
that is brilliant thank you. Nice to see someone tells you how it's done and where you gone wrong rather than a fix. I can learn from it ;)

How do i stop it now from filtering, so it takes me to all the records, but the correct record in the main form?

Atm it's taking me to the record filtered from the rest in the main form view.
 
Last edited:
2ippy said:
that is brilliant thank you. Nice to see someone tells you how it's done and where you gone wrong rather than a fix. I can learn from it ;)

.
Oh I do so apologise, I thought you came here looking for some help, I'll tell you what, I'll go out now and buy the latest version of Access so that I can view and fix your problems without you having to do anything yourself.
 

Users who are viewing this thread

Back
Top Bottom