Display all records when TeamLeaderID = 4 has been chosen in

R

RWalther

I have a main form with a combo and a subform that displays record
according to the selection in the combo. I need to do something lik
If Team Leader ID = 4 in combo display in subform the selected field
from all records where Team Leader ID 1 or 2 or 3. Form and subfor
are linked by Team Leader ID, but since no record contains Tea
Leader ID = 4 in respective field, no records show up in subform, bu
all records should show up, because # 4 stands for sales director wh
oversees all records, people...I do not know how to make thi
happen...I just want all records to show up when Team Leader ID =
has been chosen in combo in main form

Rache
 
M

Marshall Barton

RWalther said:
I have a main form with a combo and a subform that displays records
according to the selection in the combo. I need to do something like
If Team Leader ID = 4 in combo display in subform the selected fields
from all records where Team Leader ID 1 or 2 or 3. Form and subform
are linked by Team Leader ID, but since no record contains Team
Leader ID = 4 in respective field, no records show up in subform, but
all records should show up, because # 4 stands for sales director who
oversees all records, people...I do not know how to make this
happen...I just want all records to show up when Team Leader ID = 4
has been chosen in combo in main form?


You can not use the Link Master/Child properties for
anything beyond an equal comparison.

You could set the subform's RecordSource property to a
constructed query. You didn't say what the subform's record
source was, but if it were just a table, the code might be
something like:

strSQL = "SELECT * FROM table "
If Me.combo < 4 Then
Me.subform.Form.RecordSource = strSQL _
& "WHERE leaderID=" & Me.combo
ElseIf Me.combo = 4 Then
Me.subform.Form.RecordSource = strSQL
Else
MagBox "Invalid value in combo box: " & Me.combo
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top