Q: filter mainform based on value in (linked) subform

J

Jen

I try to open a mainform (frm_fakturainmatning) and it's subform
(frm_fakturarader_subform) from a startform (frm_startform) and filter the
mainform based on value of textfield in the subform (txt_forklaring).

On the startform (frm_startform) I have an unbound textbox
(txt_bladdra_per_fritext), and based on the value in this textform I want to
filter the mainform (where matches are found in the mainforms subform's
(txt_forklaring) fields). I pass the value like this:

stLinkCriteria =
"forms!fakturainmatning!fakturarader_subform.Form!forklaring Like '*" &
[Forms]![startform]![txt_bladdra_per_fritext] & "*'"

The system can't find the subforms textfield txt_forklaring. I guess that is
because the field forklaring isn't in the recordsource of the mainform. If I
put it there and change the stLinkCriteria accordingly then the filter
works, but then the mainform cykles through all the records in the subform
(the subform is datasheet and holds several records on the/ per mainform).
The mainforms recordsource/ query is bound to 3 tables. The subform
recordsource/ query is bound to its own table ("tbl_fakturarader", limked to
the tables in the recordsource/ query for the mainform).

I'm sorry that I can't explain this better in english, I know it could be
hard to understand what I'm trying to explain. Please ask for clarification
and I will do my best to answer you. Any help on how to filter mainform
based on value in (linked) subform would be wery appreciated.

Jen
 
J

John Viescas

Already answered in Forms. It is OK to cross-post (send one message to
several newsgroups) to a couple of relevant newsgroups, but please do not
multi-post (send the same message individually to different newsgroups).

Also see: http://www.mvps.org/access/netiquette.htm

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 

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