|
-
Jun 19th, 2006, 08:53 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED]Email with Access Macro or VBA?
I am using Access 2000 and trying to have it email a report after the user clicks on a button.
I used a macro on a previous program and it worked fine. However, in this new program it doesn't seem to be working entirely the same, and I think it's because I have a subform.
The macro is set up as such...
Action: Open Report
--Name: rptBuilder
--View: Print Preview
--Where Condition: [tblAccounts]![IncidentNum]=[Forms]![frmBldrNewAcct]![sfrmBldr]![txtIncidentNum]
Action: Send Object
--Type: Report
--Name: rptBuilder
--Format: Snapshot
--Email: [email protected]
On the form I have a hidden textbox which populates with an autonumber as soon as the user starts entering data for a new record. After the user enters all the data they click on a command button at the bottom of the screen which calls the macro shown above.
What happens with the macro is it opens a report I created and uses the Where Condition to use the "hidden autonumber" from the form to move focus in the table to that specific record they just entered so that information from the record is displayed in the report. A snapshot is taken and then emailed out.
The problem is after the button is clicked to email the data a window pops up asking for a parameter which is the autonumber. However, the user will never know the autonumber since that textbox is hidden and even if I show it I don't want the user to have to enter any parameter.
As I said before I used this same method on a previous program and everythign ran through perfect without it asking for any parameter. I "think" the reason it's asking now is because I have a subform on that form with the command button.
I tried the following two statements for the Where Condition but it still won't work the same. Anyone know what's going on? Or should I just use VBA, but I'm not sure how to email a report with VBA.
[tblAccounts]![IncidentNum]=[Forms]![frmBldrNewAcct]![sfrmBldr]![txtIncidentNum]
[tblAccounts]![IncidentNum]=[Forms]![sfrmBldr]![txtIncidentNum]
Last edited by lilmark; Jun 19th, 2006 at 11:17 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|