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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can "To:"-address in a macro be set from VBA code?

Status
Not open for further replies.

nrjhano

Technical User
May 9, 2000
19
0
0
SE
MS access-97 SR-2
Windows 95

VBA-code
DoCmd.RunMacro "Print schedule"

Action arguments...
Object type: Report
Object name: Schedule
Output format: Snapshot format:
To: <blank>
etc.

Is there a way to set the &quot;To:&quot;-address from VBA code?

The following code works fine for other formats...
DoCmd.SendObject acSendTable, &quot;MyReport&quot;, acFormatRTF, JPstaff, , , RepSubj, actrep, True

Does Access 2000 contain a solution?

Hakan
Osaka 2000-10-29
 
I'm assuming that the macro &quot;Print Schedule&quot; is a query. You can set up a form with a text box. In your query you can reference your form and the object &quot;The text box&quot; and feed the query your criteria. Example of criteria refering to a form. The following is part of the criteria in query:[forms]![fm_ARInquiryUnpaid]![text90]. The values are passed from the form into the query which is executed by running a command button for a report. Hope that helps.

pcdaveh
 
Nice suggestion which seems likely to work.

However, when I put following statements in the &quot;To:&quot; row of the makro:
[Forms]![wisdwork]![Combo187] <active page while sending makro>
...the string was not dereferenced. It does dereference within my VBA code at this stage, I have checked that. Also, he referenced address worked when inserted directly into the email, blank option.

I also tried [Forms]![Schedule]![emailto] which belongs to the actual snapshot'ed report included in the mail. I would not have thought that should work and it did not.

So it seems like the Macro cannot dereference the variable content on the &quot;To:&quot; row? I have tried to run the macro both from VBA-code and separately by use of the &quot;Run&quot; macro button but with the same result.

(I am sorry for my late response)

Hakan
 
Solved the problem by converting makro into visual basic which allows inclusion of addresses.
Hakan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top