Referring to form control

J

John M

I have a dialog form, with 4 unbound text controls.
TestNo1 TestNo2 TestNo3 TestNo4
This form opens a 1 page report with (for ex.) one control.
(TestNo?X.?.. see below)

In the report query, I have a tblPrintMultiplier with [PrintMultiplier]
values from 1 to 4, in a Cartesian relationship with my other report
table/s.
This PrintMultiplier can cause from 1 to 4 report pages to print.

For example if PrintMultiplier = 4

How can I use that PrintMultiplier in my query, to refer to
the open Forms!frmFormName!TestNo values, so
page one displays TestNo1
page 2 displays TestNo2
etc.

I just can't seem to find the correct syntax.

Thanks
John
 
D

Dorian

Af far as I know, you cannot 'create' a variable name in a query.
However, you could do something like
IIF(PM=1,...,IIF(PM=2,...,IIF(PM=3...,...)))
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
J

John M

Dorian,
Well, I was hoping to use PM =1 and "TestNo" to identify TestNo1
on the open dialog form, and so on.
Actually, on the form itself I use Me("TestNo" & PCNo) to identify
the [TestNo1] control.
(I use PCNo on the form just like I'm trying to use PM on the report)
But perhaps, as you say, it's not possible for a query/SQL to use
such a reference.

I would think your method would work, as long as there will be just
be 4 possible values. Any more than that could get a bit "clunky"

Let me give that a try, and I'll get back.
Thanks-
John

Dorian said:
Af far as I know, you cannot 'create' a variable name in a query.
However, you could do something like
IIF(PM=1,...,IIF(PM=2,...,IIF(PM=3...,...)))
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and
they
eat for a lifetime".


John M said:
I have a dialog form, with 4 unbound text controls.
TestNo1 TestNo2 TestNo3 TestNo4
This form opens a 1 page report with (for ex.) one control.
(TestNo?X.?.. see below)

In the report query, I have a tblPrintMultiplier with [PrintMultiplier]
values from 1 to 4, in a Cartesian relationship with my other report
table/s.
This PrintMultiplier can cause from 1 to 4 report pages to print.

For example if PrintMultiplier = 4

How can I use that PrintMultiplier in my query, to refer to
the open Forms!frmFormName!TestNo values, so
page one displays TestNo1
page 2 displays TestNo2
etc.

I just can't seem to find the correct syntax.

Thanks
John



.
 
J

John M

Dorian,
That did the trick.
I used it in a pass-thru query.
Thanks,
John

Dorian said:
Af far as I know, you cannot 'create' a variable name in a query.
However, you could do something like
IIF(PM=1,...,IIF(PM=2,...,IIF(PM=3...,...)))
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and
they
eat for a lifetime".


John M said:
I have a dialog form, with 4 unbound text controls.
TestNo1 TestNo2 TestNo3 TestNo4
This form opens a 1 page report with (for ex.) one control.
(TestNo?X.?.. see below)

In the report query, I have a tblPrintMultiplier with [PrintMultiplier]
values from 1 to 4, in a Cartesian relationship with my other report
table/s.
This PrintMultiplier can cause from 1 to 4 report pages to print.

For example if PrintMultiplier = 4

How can I use that PrintMultiplier in my query, to refer to
the open Forms!frmFormName!TestNo values, so
page one displays TestNo1
page 2 displays TestNo2
etc.

I just can't seem to find the correct syntax.

Thanks
John



.
 

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