Fill in Label on Report from form

  • Thread starter Thread starter pells22
  • Start date Start date
P

pells22

Guest
I have been reading all the posts and am very confused on this. Basically I have a combo box that a user selects a state on. Then it produces a report that has all the listings in the DB for that state, that was the easy part:)

Now all I want to do is in the report header in Label61 put the state they selected from the combo box. I have tried a bunch of things, but I can not seem to get focus to the report.

Then I tried this code in the on open of the report. The report runs without an error but nothing shows in that label.


=[label61].[Caption]=[Forms]![Facility Selection For open Quote]![Combo9]

Please let me know what I am doing wrong.

Thanks,
 
Put a text box (not a label) on the form and place the reference:

=[Forms]![Facility Selection For open Quote]![Combo9]

in the text box.

(As an aside, naming conventions are there to help you in the long run! With a form name that has spaces and a combo that is not named but left with the default 'Combo9', you are setting yourself up for some trouble later. I would recommend studying proper naming conventions. Trust me, you'll be thankful in the long run!)
 
The combo box reports back to a control source...correct? So, just drap the field from the field list into the the report header. I do that all of the time when I want to emphasize to the customer which region the particular report is for.
I don't know exactly why you would want to have your label appear in the header....if you want to show the combo selection and you're running the report for a single [State], then just drag the bound text box into the header!
:D
 
I forgot to mention one fact

That makes sense, except we convert our state and year here to a code (i.e. Massachusetts 2002 becomes MA02). So to make it easier I am going to use the form and let them choose by full names, then I abreviate it in the form to do the query. So in the control source it is MA02 and I really want the Report to say Massachusetts.

Thanks,
 
You could use Dlookup to refer to the table that tells Access what "MA02" stands for, and place that in the header (use a text box, not a 'label').
 
iif statement

Thanks for the help. I managed to do it with a multiple iif statement and a hidden text box. I am very familiar with VB and access is very different, in VB you pass information back and forth between screen so much easier.
 
Consider using another table, one that lists "MA"|"Massachusetts", etc. Then if you Dlookup to that table, you can find out what state you're looking at.

Note that I am assuming this is something to be done once in a report header. If this will happen often in the report, make a join to that new table and include it in your query, rather than doing many Dlookups (which get expensive, CPU-wise).
 

Users who are viewing this thread

Back
Top Bottom