M
mckitlk
Hello, everyone,
I'm wondering if anyone has any suggestions for this...
I want this data entry form to allow access to only a subset of
records in the underlying table, based on their Type Code. I have a
Type Code lookup table, with a Yes/No column to indicate which Type
Codes are allowed in the form. The lookup is linked to the main table
via a lookup field, and shows in the form in a combo box field.
Setting up the combo box SELECT query to limit the list to just the
allowed values was easy. It just needed a WHERE clause to check for
True in that Yes/No column.
My problem now is how to get the form's filter to block records with
Type Codes that aren't allowed. I've tried various methods of setting
the filter to something like "cbxTypeCode.Column(2) = True", both in
the Properties dialog and in code. I've also tried putting a hidden
check box on the form to pick up the value of this column, then filter
on "HiddenBox = True". Neither work - I get either syntax errors or
parameter requests.
I don't want to hard-code the Type Code into the filter because I want
this to be dynamic. If new Type Codes are added, I shouldn't have to
do more than check that Yes/No box to add them to this form.
I can build the filter string in code by doing a SELECT query and then
looping through the result. But before I do that, is there an easier,
more direct and straightforward way?
Thanks so much in advance!
Laura
I'm wondering if anyone has any suggestions for this...
I want this data entry form to allow access to only a subset of
records in the underlying table, based on their Type Code. I have a
Type Code lookup table, with a Yes/No column to indicate which Type
Codes are allowed in the form. The lookup is linked to the main table
via a lookup field, and shows in the form in a combo box field.
Setting up the combo box SELECT query to limit the list to just the
allowed values was easy. It just needed a WHERE clause to check for
True in that Yes/No column.
My problem now is how to get the form's filter to block records with
Type Codes that aren't allowed. I've tried various methods of setting
the filter to something like "cbxTypeCode.Column(2) = True", both in
the Properties dialog and in code. I've also tried putting a hidden
check box on the form to pick up the value of this column, then filter
on "HiddenBox = True". Neither work - I get either syntax errors or
parameter requests.
I don't want to hard-code the Type Code into the filter because I want
this to be dynamic. If new Type Codes are added, I shouldn't have to
do more than check that Yes/No box to add them to this form.
I can build the filter string in code by doing a SELECT query and then
looping through the result. But before I do that, is there an easier,
more direct and straightforward way?
Thanks so much in advance!
Laura