Pass value from combo box to report

S

Siew-Ming

Hi,

I setup a table with three fields as shown below for a combo box displays on
a form.

Quarter Marknum Quarter_Desc
1 1 First
2 3 Second
3 5 Third
4 7 Fourth

How do I pass the value of the the 3rd column from a form to a report
so that it knows to display the description?

In the Control Source of the text box on the report, I tried to populate with

=[Forms]![frmMainForm]![cbo27].column(2)

I got #error from previewing the report.

Also, how do I pass the value of the marknum of the selected quarter to a
query that has data of four quarters? Would a function for case selection
works? What is your recommendation?

Thanks a bunch,
Sming
 
P

Paolo

Hi Siew Ming,

for your first question

=[Forms]![frmMainForm].Form![cbo27].column(2)
Obviously to refer to a field of frmMainForm this form must be open.

For the second question
In the structure of your query add in the criteria line the reference to
marknum as follow
=[Forms]![frmMainForm].Form![cbo27].column(1)

HTH Paolo
 
E

EarlCPhillips

I agree with Paolo except I use it this way:

field reference = cboName.Colunm(2) with the form open, performed from a
Private Sub cboPgmHostName_BeforeUpdate(Cancel As Integer)
BeforeUpdate event, e.g.

Forms!frmFinalProjStrEval!txtSessNbr = cboPgmHostName.Column(2)

Earl Phillips
--
Trying To Feed The Hungry


Paolo said:
Hi Siew Ming,

for your first question

=[Forms]![frmMainForm].Form![cbo27].column(2)
Obviously to refer to a field of frmMainForm this form must be open.

For the second question
In the structure of your query add in the criteria line the reference to
marknum as follow
=[Forms]![frmMainForm].Form![cbo27].column(1)

HTH Paolo


Siew-Ming said:
Hi,

I setup a table with three fields as shown below for a combo box displays on
a form.

Quarter Marknum Quarter_Desc
1 1 First
2 3 Second
3 5 Third
4 7 Fourth

How do I pass the value of the the 3rd column from a form to a report
so that it knows to display the description?

In the Control Source of the text box on the report, I tried to populate with

=[Forms]![frmMainForm]![cbo27].column(2)

I got #error from previewing the report.

Also, how do I pass the value of the marknum of the selected quarter to a
query that has data of four quarters? Would a function for case selection
works? What is your recommendation?

Thanks a bunch,
Sming
 
E

EarlCPhillips

Upon further relection, to place that data on a REPORT, place field-reference
(e.g. [Forms]![frmFinalProjStrEval]![tstSessNbr]) in the Criteria field of
the query used as input to the report so the query retrieves that value from
the open form and makes it available to the report. There must be some
command button on the open form to initiate the report with a click event.

Earl Phillips
Volunteer Ex-mainframer Learning Access
Harvesters Community Food Bank
--
Trying To Feed The Hungry


EarlCPhillips said:
I agree with Paolo except I use it this way:

field reference = cboName.Colunm(2) with the form open, performed from a
Private Sub cboPgmHostName_BeforeUpdate(Cancel As Integer)
BeforeUpdate event, e.g.

Forms!frmFinalProjStrEval!txtSessNbr = cboPgmHostName.Column(2)

Earl Phillips
--
Trying To Feed The Hungry


Paolo said:
Hi Siew Ming,

for your first question

=[Forms]![frmMainForm].Form![cbo27].column(2)
Obviously to refer to a field of frmMainForm this form must be open.

For the second question
In the structure of your query add in the criteria line the reference to
marknum as follow
=[Forms]![frmMainForm].Form![cbo27].column(1)

HTH Paolo


Siew-Ming said:
Hi,

I setup a table with three fields as shown below for a combo box displays on
a form.

Quarter Marknum Quarter_Desc
1 1 First
2 3 Second
3 5 Third
4 7 Fourth

How do I pass the value of the the 3rd column from a form to a report
so that it knows to display the description?

In the Control Source of the text box on the report, I tried to populate with

=[Forms]![frmMainForm]![cbo27].column(2)

I got #error from previewing the report.

Also, how do I pass the value of the marknum of the selected quarter to a
query that has data of four quarters? Would a function for case selection
works? What is your recommendation?

Thanks a bunch,
Sming
 

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