Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Coding text boxes on a report in access

Posted on 2009-04-20
8
Medium Priority
?
249 Views
Last Modified: 2013-11-28
I have a report (rpt_CustomerQuoteCategoryA) whose purpose is to display some information on a certain form (frm_GenerateQuoteCategoryA). The button on the form that opens this report has code to open the report as a preview, and to update all the text boxes on the report to correspond to the text boxes on the form. Here is the code:

Private Sub cmd_ViewReport_Click()

DoCmd.OpenReport "rpt_CustomerQuoteCategoryA", acViewPreview, , , acWindowNormal

Reports!rpt_CustomerQuoteCategoryA!txt_Price1 = Forms!frm_GenerateQuoteCategoryA!txt_Price1
Reports!rpt_CustomerQuoteCategoryA!txt_Price2 = Forms!frm_GenerateQuoteCategoryA!txt_Price2
Reports!rpt_CustomerQuoteCategoryA!txt_Price3 = Forms!frm_GenerateQuoteCategoryA!txt_Price3

When I run this code, the report opens but there is nothing in each text box. To make sure that access was reading the value, I added the following code:

'Debug.Print Reports!rpt_CustomerQuoteCategoryA!txt_Price1

Which verified that the value of the txt_Price1 text box was correct, but still does not display on the report.

Thanks for your help.

0
Comment
Question by:lericks3
7 Comments
 
LVL 10

Expert Comment

by:Korbus
ID: 24190502
Hmm.. Can you "refresh" a report?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 24191543
You need to pull the data into the report rather than push it from the form.

How you do this might depend on your report structure but you can try the Format event procedure for the report section containing the price controls.
me!txt_Price1 = Forms!frm_GenerateQuoteCategoryA!txt_Price1
me!txt_Price2 = Forms!frm_GenerateQuoteCategoryA!txt_Price2
me!txt_Price3 = Forms!frm_GenerateQuoteCategoryA!txt_Price3
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24192526
lericks3,

Pete's post should solve you question directly.

Can I ask if the Form is bound to a table or query (Recordsource)?
If so, then why not base the report on the same recordsource as the Form?
Thus, avoiding the issue altogether?

If the form is unbound, then I understand you reasoning.
;-)

JeffCoachman
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:lericks3
ID: 24206289
Actually my form is pulling inforomation from a parameters form so I can't change the recordsource.

The me!txt_Price1 = Forms!frm_GenerateQuoteCategoryA!txt_Price1 solution did actually not work. I ended up changing the event procedure from on click of the form button to on load of the report.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 24206363
'from on click of the form button '

I don't think anyone said you should do it there.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24211661
lericks3,

<my form is pulling inforomation from a parameters form so I can't change the recordsource.>

This really shouldn't matter.
But then again, I am not familiar with your database structure.

So, Problem solved?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24216189
I think you accepted the wong post.

Wheather you rform is bound or not, Pete's Post is the answer.

;-)

Jeff
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question