Hello,
I have two forms: frmDialogueBox and frmSearchCustom er.
In first one I've put in a List Box with three options: ID, First Name, Surname.
In second one I've all fields based on my Customer table, tblCustomer.
What I am trying to do is to allow the user to search for different records and display them in the second form based on the criteria chosen in first form.
I have tried to set up the VB code in the first form with the list box as follows:
However, It doesn't want to work, when I open the second form.
I have two forms: frmDialogueBox and frmSearchCustom er.
In first one I've put in a List Box with three options: ID, First Name, Surname.
In second one I've all fields based on my Customer table, tblCustomer.
What I am trying to do is to allow the user to search for different records and display them in the second form based on the criteria chosen in first form.
I have tried to set up the VB code in the first form with the list box as follows:
Code:
Private Sub List0_AfterUpdate() Dim strSource As String If List0 = "ID" Then strSource = "SELECT * FROM tblCustomer WHERE (((tblCustomer.CustomerID = [Please enter Customer ID: ])));" End If If List0 = "Surname" Then strSource = "SELECT * FROM tblCustomer WHERE (((tblCustomer.Surname = [Please enter Customer's Surname ])));" End If If List0 = "First Name" Then strSource = "SELECT * FROM tblCustomer WHERE (((tblCustomer.FirstName = [Please enter Customer's First Name: ])));" End If Forms_frmCustomerBasic.RecordSource = strSource End Sub
Comment