Q: Value from query to stLinkCriteria

  • Thread starter Thread starter Jen
  • Start date Start date
J

Jen

I have a form with a query (qry_alarm) as recordsource. The query often has
multiple values in the query column "fakturanr".

On this form I need a commandbutton when, as clicked, by stLinkCriteria or
similar opens a second form filtered to show only records matching the
fakturanr from the first forms recordsource/ query.

If I write

stLinkCriteria = "fakturanr=114" the second form opens ok filtered to show
only the record 114

My problem is how to pass the value(s) "fakturanr" from the first forms
recordsource/ query to the form being opened/filtered.

I tried putting a combobox with it's recordsource as the query (fakturanr),
but then the second form opens filtered to just the one "fakturanr" that was
selected when hitting the button (now with the stLinkCriteria =
"fakturanr=me![combo_box_containing_fakturanr]).

How do I pass all the "fakturanr" values to the second form? I have fiddled
with loads of variations to get the value passed, even some loop...
experiments but without success.

Jen.
 
Assuming fakturanr is numeric:

stLinkCriteria = "fakturanr=" & Me![combo_box_containing_fakturanr]

You must concatenate the form variable to the string.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Jen said:
I have a form with a query (qry_alarm) as recordsource. The query often has
multiple values in the query column "fakturanr".

On this form I need a commandbutton when, as clicked, by stLinkCriteria or
similar opens a second form filtered to show only records matching the
fakturanr from the first forms recordsource/ query.

If I write

stLinkCriteria = "fakturanr=114" the second form opens ok filtered to show
only the record 114

My problem is how to pass the value(s) "fakturanr" from the first forms
recordsource/ query to the form being opened/filtered.

I tried putting a combobox with it's recordsource as the query (fakturanr),
but then the second form opens filtered to just the one "fakturanr" that was
selected when hitting the button (now with the stLinkCriteria =
"fakturanr=me![combo_box_containing_fakturanr]).

How do I pass all the "fakturanr" values to the second form? I have fiddled
with loads of variations to get the value passed, even some loop...
experiments but without success.

Jen.
 
Thank you Arvin for your responce. However I still get only one record.
Maybe this is a wrong approach alltogether? The second forms "fakturanr" is
an unique record for that form. Maybe my stLinkCriteria should be something
like between min value of fakturanr and max value of fakturanr??

Further help would be wery appreciated, Jen

Arvin Meyer said:
Assuming fakturanr is numeric:

stLinkCriteria = "fakturanr=" & Me![combo_box_containing_fakturanr]

You must concatenate the form variable to the string.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Jen said:
I have a form with a query (qry_alarm) as recordsource. The query often has
multiple values in the query column "fakturanr".

On this form I need a commandbutton when, as clicked, by stLinkCriteria or
similar opens a second form filtered to show only records matching the
fakturanr from the first forms recordsource/ query.

If I write

stLinkCriteria = "fakturanr=114" the second form opens ok filtered to show
only the record 114

My problem is how to pass the value(s) "fakturanr" from the first forms
recordsource/ query to the form being opened/filtered.

I tried putting a combobox with it's recordsource as the query (fakturanr),
but then the second form opens filtered to just the one "fakturanr" that was
selected when hitting the button (now with the stLinkCriteria =
"fakturanr=me![combo_box_containing_fakturanr]).

How do I pass all the "fakturanr" values to the second form? I have fiddled
with loads of variations to get the value passed, even some loop...
experiments but without success.

Jen.
 
... of course not between min-max... I'm starting to boil my brain here, time
for a coffeebreak. Btw that second form's fakturanr is that forms underlying
table's primary key and thus it's unique for each record the second form
shows. Is this why I only get one record filtered?

Jen.

Jen said:
Thank you Arvin for your responce. However I still get only one record.
Maybe this is a wrong approach alltogether? The second forms "fakturanr" is
an unique record for that form. Maybe my stLinkCriteria should be something
like between min value of fakturanr and max value of fakturanr??

Further help would be wery appreciated, Jen

Arvin Meyer said:
Assuming fakturanr is numeric:

stLinkCriteria = "fakturanr=" & Me![combo_box_containing_fakturanr]

You must concatenate the form variable to the string.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Jen said:
I have a form with a query (qry_alarm) as recordsource. The query
often
has
multiple values in the query column "fakturanr".

On this form I need a commandbutton when, as clicked, by
stLinkCriteria
or
similar opens a second form filtered to show only records matching the
fakturanr from the first forms recordsource/ query.

If I write

stLinkCriteria = "fakturanr=114" the second form opens ok filtered to show
only the record 114

My problem is how to pass the value(s) "fakturanr" from the first forms
recordsource/ query to the form being opened/filtered.

I tried putting a combobox with it's recordsource as the query (fakturanr),
but then the second form opens filtered to just the one "fakturanr"
that
was
selected when hitting the button (now with the stLinkCriteria =
"fakturanr=me![combo_box_containing_fakturanr]).

How do I pass all the "fakturanr" values to the second form? I have fiddled
with loads of variations to get the value passed, even some loop...
experiments but without success.

Jen.
 
Back
Top