B
Ben
Hi all!
I have a question with regards to what I am doing.
In the form I have separate drop down list boxes for each option. They have
respective "SELECT" row sources. The way I am doing it is that, I hide the
rest of the options and just show the main option by using the VISIBLE
property setting to FALSE or TRUE.
Below are the options and their respective Row Source" SQL:
- By Customer Name
"SELECT Customers.[Last Name], Customers.[First Name], Customers.City,
Customers.State, Customers.[Customer Number]
FROM Customers WHERE ((Not (Customers.[Last Name]) Is Null)) OR ((Not
(Customers.[First Name]) Is Null))
ORDER BY Customers.[Last Name], Customers.[First Name];"
- By Company
"SELECT Customers.Company, Customers.[Last Name], Customers.[First Name],
Customers.City, Customers.State, Customers.[Customer Number] FROM Customers
WHERE ((Not (Customers.Company) Is Null)) ORDER BY Customers.Company,
Customers.[Last Name], Customers.[First Name];"
- By Customer Number
"SELECT Customers.[Customer Number], Customers.[Last Name], Customers.[First
Name], Customers.Company, Customers.City, Customers.State FROM Customers
ORDER BY Customers.[Customer Number], Customers.[Last Name],
Customers.[First Name];"
- By Phone
"SELECT Phone AS [Telephone], [Last Name] & ", " & [First Name] AS Name,
Company, [Customer Number] FROM Customers WHERE ((Not (Phone) Is Null))
UNION SELECT [Other Phone] AS [Telephone], [Last Name] & ", " & [First
Name] AS Name, Company, [Customer Number] FROM Customers WHERE ((Not ([Other
Phone]) Is Null)) UNION SELECT Fax AS [Telephone], [Last Name] & ", " &
[First Name] AS Name, Company, [Customer Number] FROM Customers WHERE ((Not
(Fax) Is Null)) ORDER BY [Telephone], Name, Company, [Customer Number];"
Below is the script for the option selection:
Select Case Me.[Type Of Search]
Case 1
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Customer Name to Search For
"
[By Search Type CustNum].Visible = False
[By Search Type Company].Visible = False
[By Search Type].Visible = False
[By Search Type CustName].Visible = True
[By Search Type CustName].SetFocus
Case 2
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Company to Search For "
[By Search Type CustNum].Visible = False
[By Search Type].Visible = False
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = True
[By Search Type Company].SetFocus
Case 3
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Customer Number to Search For
"
[By Search Type].Visible = False
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = False
[By Search Type CustNum].Visible = True
[By Search Type CustNum].SetFocus
Case 4
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Phone Number to Search For
"
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = False
[By Search Type CustNum].Visible = False
[By Search Type].Visible = True
[By Search Type].SetFocus
End Select
"By Phone" is the default option. The problem that I am encountering is
that when I click a different option (e.g. By Company) and then go back to
"By Phone" option, the drop down list box does not have any records at all.
What am I doing wrong?
Thanks for the help in advance!
I have a question with regards to what I am doing.
In the form I have separate drop down list boxes for each option. They have
respective "SELECT" row sources. The way I am doing it is that, I hide the
rest of the options and just show the main option by using the VISIBLE
property setting to FALSE or TRUE.
Below are the options and their respective Row Source" SQL:
- By Customer Name
"SELECT Customers.[Last Name], Customers.[First Name], Customers.City,
Customers.State, Customers.[Customer Number]
FROM Customers WHERE ((Not (Customers.[Last Name]) Is Null)) OR ((Not
(Customers.[First Name]) Is Null))
ORDER BY Customers.[Last Name], Customers.[First Name];"
- By Company
"SELECT Customers.Company, Customers.[Last Name], Customers.[First Name],
Customers.City, Customers.State, Customers.[Customer Number] FROM Customers
WHERE ((Not (Customers.Company) Is Null)) ORDER BY Customers.Company,
Customers.[Last Name], Customers.[First Name];"
- By Customer Number
"SELECT Customers.[Customer Number], Customers.[Last Name], Customers.[First
Name], Customers.Company, Customers.City, Customers.State FROM Customers
ORDER BY Customers.[Customer Number], Customers.[Last Name],
Customers.[First Name];"
- By Phone
"SELECT Phone AS [Telephone], [Last Name] & ", " & [First Name] AS Name,
Company, [Customer Number] FROM Customers WHERE ((Not (Phone) Is Null))
UNION SELECT [Other Phone] AS [Telephone], [Last Name] & ", " & [First
Name] AS Name, Company, [Customer Number] FROM Customers WHERE ((Not ([Other
Phone]) Is Null)) UNION SELECT Fax AS [Telephone], [Last Name] & ", " &
[First Name] AS Name, Company, [Customer Number] FROM Customers WHERE ((Not
(Fax) Is Null)) ORDER BY [Telephone], Name, Company, [Customer Number];"
Below is the script for the option selection:
Select Case Me.[Type Of Search]
Case 1
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Customer Name to Search For
"
[By Search Type CustNum].Visible = False
[By Search Type Company].Visible = False
[By Search Type].Visible = False
[By Search Type CustName].Visible = True
[By Search Type CustName].SetFocus
Case 2
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Company to Search For "
[By Search Type CustNum].Visible = False
[By Search Type].Visible = False
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = True
[By Search Type Company].SetFocus
Case 3
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Customer Number to Search For
"
[By Search Type].Visible = False
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = False
[By Search Type CustNum].Visible = True
[By Search Type CustNum].SetFocus
Case 4
[By Search Type].RowSource = ""
[Search Text].Caption = "Select the Phone Number to Search For
"
[By Search Type CustName].Visible = False
[By Search Type Company].Visible = False
[By Search Type CustNum].Visible = False
[By Search Type].Visible = True
[By Search Type].SetFocus
End Select
"By Phone" is the default option. The problem that I am encountering is
that when I click a different option (e.g. By Company) and then go back to
"By Phone" option, the drop down list box does not have any records at all.
What am I doing wrong?
Thanks for the help in advance!