A Button's onclick event coding

  • Thread starter Thread starter Curtis Stevens
  • Start date Start date
C

Curtis Stevens

I have a button on a form and when I click it, I want it to execute some
coding. I'm using some code that prints and converts a report to PDF and
then does something with that PDF. My question is how do you reference a
field on that report being used, or a field in the query that runs the
report. Usually, when refenrencing something on the form, I use
Me.NAMEOFFIELD, but I'm trying to reference a field in a report / or field in
the query the report uses.

Any help?

Thanks
Curtis
 
Fields in a query are referenced wherever the query's results are used.
Fields in a report are referenced in the report.
The basic rule is you reference things you have come from not things you are
going to.
In other words you cannot reference fields in a report from a button that
will open the report. You can reference fields on a form that the report has
been opened from.
Hope this is clear.

-Dorian
 
Ok, this is the coding I want to execute, any advise? I tried putting it in
the report, as an on close event, but wont let me do that.

Dim blRet As Boolean
blRet = ConvertReportToPDF("UnPaidAffiliatesResiduals", vbNullString,
"C:\USMS\Affiliates\ & Me.AffiliateID" & "test" & ".pdf", False, False, 0,
"", "", 0, 0)


What I want to happen is all the information that pulls up when the report
is ran, to print into pdf files and print that pdf files into individual
folders for each affiliate. In other words, I have affiliates I pay monthly
monies to. I want to print their monthly report into a pdf and have it go
into their particular folder I have on my computer for them (the name of that
folder is me.affiliateid. I have my report setup so the it groups all the
data by affiliates.

Curtis
 
Back
Top