Solved Issue Filling Report fields based on a previous form (1 Viewer)

theferd

Registered User.
Local time
Today, 06:30
Joined
Dec 23, 2019
Messages
42
I'll preface this issue that I have little experience with reports in relation to the code builder.
What I am trying to accomplish is filling in several text boxes on my report using combo boxes that a user would select on a previous form.
For example:
Code:
DoCmd.OpenReport "Singlesourcedreport", acViewPreview
Reports!Singlesourcedreport.txtcatalog = Me.txtcatalog

Other lines are similar direct transfers and DLookup.controlsource, etc.
The issue is that the report preview does not seem to update these fields. I assume this is because of how the openreport command generates based on initial values of each text box. I tried OpenArgs or opening the report again, but none of these seemed to change anything. Is there a crucial step that I'm missing here or another way around this or is this a hard limitation for Access
 

Ranman256

Well-known member
Local time
Today, 06:30
Joined
Apr 9, 2015
Messages
4,339
fill the report from a query ,based on the form items.
select tbl.date, forms!myform!txtBox1 from table.

dont fill it post opening the report, let the query grab everything.
 

bastanu

AWF VIP
Local time
Today, 03:30
Joined
Apr 13, 2010
Messages
1,402
If the "previous form" is still open (it has to be if you want this to work) then simply open the report in design view and in the controls you want to be populated from the form use the control source to reference the form controls: =Forms!frmSingleSource!txtcatalog

Cheers,
 

theferd

Registered User.
Local time
Today, 06:30
Joined
Dec 23, 2019
Messages
42
Ill give both methods a try and return with results. Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:30
Joined
Feb 19, 2002
Messages
43,213
Report View doesn't run all your code. Only Print Preview and Print will run all your code.

It's quite the conundrum. If you want the "live" features of report view, you give up the ability to run parts of your code.
 

theferd

Registered User.
Local time
Today, 06:30
Joined
Dec 23, 2019
Messages
42
So I ended up using a mixture of cross tab references for more basic text fields and query generation for dynamic lists on my report. The formatting is a bit scuffed but it appears to be working correctly. Thanks all.
 

Users who are viewing this thread

Top Bottom