Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OutputTo acOutputReport values not showing 1

Status
Not open for further replies.

Bobnz

IS-IT--Management
Aug 19, 2002
116
NZ
I,m having trouble with a report that is based on a query. In the query the criteria for each field is a function that returns a value(this value changes) from a global variable.

when I run this code...
Code:
DoCmd.OutputTo acOutputReport, report_name, acFormatRTF, "C:\Documents and Settings\Bob\My Documents\Order.rtf"
And go to where the 'order.rtf' file is saved, the report shows no values just the labels.

But when I run:

Code:
DoCmd.OpenReport "order", acViewPreview
the report opens and all the values are there.

The global variables are assigned values when the user clicks the order button a call is then made to the
create_order function where the DoCmd.OutputTo acOutputReport....is carried out. The 'order.rtf' file is sent as an attachment. I'm trying to automate the order process.

B
 
How annoying. I am gussing it has to do with the code behind the criteria.

Can you have your source query make a static table, and base the report on that table?

Or, export as a snapshot?

I think either would work. I find that rtf always seems to have something wrong any time there is any vba associated.

ChaZ
 
Thanks for the reply, how would I have the query make a static table?


The code in criteria is a function call..

=return_jobnumber()


function is...

Code:
function return_jobnumber()

  return_jobnumber = jnum

end function

jnum is a global veriable


B
 
Hi. What I mean is your report is based on a query that uses the return_jobnumber function. Change the query to a make table query, and base the report on the table. That way, when the report is run, its based on the table data.

ChaZ
 
Thanks thats sort of what I did.

I created a new table --> inserted the row/record values using global vars -->based report on the table -->run DoCmd.OutputTo acOutputReport, report_name, acFormatRTF, "C:\Documents and Settings\Bob\My Documents\Order.txt" --> delete record from new table --> insert record into orders table --> call email function

Everything seems to work ok :) no doubt there is a proper or better way but "if it aint broke don't fix it".

Thanks for the help

B
 
Glad it worked. Again, any time vba is involved, rtf seems to fail, but if you are sending to other folks that use ms office, then you can use snapshot, which seems to always work. Go figure.

ChaZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top