mrmozambique
Registered User.
- Local time
- Today, 18:33
- Joined
- May 20, 2009
- Messages
- 16
Hi all.
I've been struggling with this the last several days and just can't seem to get it straightened out. It's a DB for tracking HIV/AIDS health data at an NGO in Vietnam.
I have a main form with four subforms all tied together with mother/child link field. All subforms are invisible until you select an unbound combo on the main form. There's an afterupdate event on the unbound combo that shows the appropriate subform and hides all others. This works fine.
However, my subform doesn't filter the items correctly. Each subform should be filtering out items related to the category selected in the unbound combo on the main form. Since the number of options is relatively limited, I've just hard-coded the IDs into the filter property of the subform. It looks something like this:
I've also tried changing the filter in VBA, something like the below. It's in the VBA code for the main form's unbound combo afterupdate (embedded in some if statements).
Note that program_id is a field from the subform's related table and the combo related to that field is cboprogram_id. The property filter returns nothing (although there are certainly records with one or more of the above program_ids) and the VBA returns everything without filtering it.Am I missing some quotes or some other symbol here?? Any ideas why the filter isn't working?
Thanks in advance!
I've been struggling with this the last several days and just can't seem to get it straightened out. It's a DB for tracking HIV/AIDS health data at an NGO in Vietnam.
I have a main form with four subforms all tied together with mother/child link field. All subforms are invisible until you select an unbound combo on the main form. There's an afterupdate event on the unbound combo that shows the appropriate subform and hides all others. This works fine.
However, my subform doesn't filter the items correctly. Each subform should be filtering out items related to the category selected in the unbound combo on the main form. Since the number of options is relatively limited, I've just hard-coded the IDs into the filter property of the subform. It looks something like this:
Code:
(([program_id]=21) or ([program_id]=22) or ([program_id]=23) or ([program_id]=30) or ([program_id]=31) or ([program_id]=32) or ([program_id]=33) or ([program_id]=34))
Code:
Form_frm_indicators_input_sub_p.Form.FilterOn = False
Form_frm_indicators_input_sub_p.Form.Filter = ([program_id] = 1) Or ([program_id] = 2) Or ([program_id] = 3) Or ([program_id] = 4) Or ([program_id] = 5)
Form_frm_indicators_input_sub_p.FilterOn = True
Thanks in advance!