Full Version: Form Filter problem
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
bronisaurus
I have a main form Staff_names with primary key STAFFIDPK. There are 3 forms based on the table StaffSkills that are opened via a command button on Staff_names.

frmLang is one of these forms. When it is opened it's field staffidskill has its Default value as =[Forms]![frmStaff_names]![STAFFIDPK]. This sets the forms' filter to [staffidskill]=5 (for example).
There is a combobox using a query to show only the languages (about 10 items from a total of about 100 "skills". I also want the form to show only this persons' languages records (not skills that will be entered via the other 2 forms). If I use the Records-Advanced Filter option I can add the skilltypeid = 3 to the already existing filter of [staffidskill]=5 and this shows what I want. i.e. (((tblStaffSkills.staffidskill)=5) AND ((tblStaffSkills.skilltypeid)=3)) BUT I want to set this filter as an onOpen event of the form and I can't do this without it being bound to just one result e.g. staffidskill=5.

I was thinking something like
(([Forms]![frmStaff_names]![STAFFIDPK])=([Forms]![Langform]![staffidskill]) WHERE ([tblStaffSkills].[skilltypeid])=3) would be the sort of filter I could use for the form but this has incorrect syntax and I don't know how to write it properly or if it can be don this way. Any ideas?

P.S. full disclosure:I did post (a more poorly worded) version of this on another forum but it is down right now and I'm hoping to make some progress on this soon!
bronisaurus
Is anyone able to help? I can't write and save a filter that does the whole job (as described above) and any filter I try to apply after the form is loaded that shows only skilltypeid =3 will work universally so all the records that are a language are shown and it is no longer limited to just that staff member.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.