How to get value from a list box

G

Guest

I have a list box called FiscalYear on a form and want to print out the
value(2007 or 2008) based on what I select from the form on the report. But
when I used Forms!frmForm1.FiscalYear on the report, I only see the #Error on
the screen. Do you know why?

Thanks a lot!

Ally
 
A

Allen Browne

Is the form still open when you run the report?

Did you include the = at the start of the expression in the control source?

Are the names correct?

What is the Name of this text box? It must not be the same as the name of
any fields in the report.
 
G

Guest

I previously has the openform command in the form, but I deleted already.

Yes, I include the = at the start of the expression like ="FY" &
Forms!frmForm1!FiscalYear in the control source.

The name of the text is Text80 as I did not give it a new name.

Please help! I only see #Name on the screen.

Thanks a lot!

Ally
 
A

Allen Browne

Press Ctrl+G to open the Immediate Window.

Enter:
? Forms!frmForm1.FiscalYear
Fix up the names until it works.

For example, to see if the form name is correct:
? Forms!frmForm1.Name

Once you get the expression working here, you can use it on your report.
 
G

Guest

Allen,

I enter the following in the code of the form:

Print Forms!frmUnder50KItemsTracking!FiscalYear

but i got a error message saying "Run time error "438": Object doesn't
support this property or method.

Please advise.

Thanks,

Ally
 
A

Allen Browne

What did you get from:
? Forms!frmUnder50KItemsTracking.Name

Still in the Immediate Window, choose Compile on the Debug menu. You may
have to fix any errors before you can get this to work.
 
A

Allen Browne

Well, something else is wrong.
The name of a form cannot be Null.

If the form is not open, the expression should error.
If the form is open, it should return its name.
 

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