"all" in combo box that open query

arsh

New member
Local time
Today, 09:19
Joined
Nov 30, 2006
Messages
7
I have a Students combo box(stedentID,studentname) that is limited by Teachers combo box(theacherID,theachername).When I click a student in a Students combo box (whith on click event) opens a query that is filtred by a selection in Students combo box.I want to have "all" in Students combo box which opens the same query and shows all stedent records.I cant do that.Please help who knows.And excuse me for poor English.
 
You Need to create a Union Query For This:

Code:
SELECT  "<<All>>" As ReminderType
FROM LtblReminderTypesLookup;
UNION SELECT LtblReminderTypesLookup.ReminderType
FROM LtblReminderTypesLookup;

The number of columns must match on both sides IE This one only uses 1 Notice Both FROM statements

Mick
 
I do it and see "all" in my combo box but when I click query shows nothing,I think that I have to add smth. to on click event of combo box
 
You need to check the user selection Something Like

If Me![YourCBO] = "All" Then
WhereSQL = ""
Else
WhereSQL ="[FieldName]=" & Me![YourCBO] 'Your Student ID?
End If
Open your qUERY Hear with the Where SQL Statement.
Use The AfterUpdate Event
 
Last edited:
Maybe another way

I have a form with a combo box "Students"(StudentID,StudentName from tblStudents),a command button which opens a query that shows Student information from tblStudents.I want the query to show the information of Student which is selected in combo box. How can I do it.
Thanks in advance.
 
if you have an "all" in the combo box, you need to modify the table query, as you cannot match a value to "all"

one way is to add another column testing whether the combo box is set to "all". I think you can test it in the criteria also.

ie =combobox or (combobox = "all")
 

Users who are viewing this thread

Back
Top Bottom