Email problems using VBA

Greatings Experts,

I have an Access database system and in that system I have a form that allows users to email a report using a button with VBA.  Up until now I have never had a problem with it.  But for some reason, now when my users try and use the button, they get nothing.  The only thing that happens is the hourglass will show for a split second and the screen flickers like it is going to generate the report and open the email dialog but then it stops: no warning message (I guess that's good) or anything.

At first I thought this was because my office upgraded to Office 2010 but then I found out this was happening to other users who use the system not even on our IT structure.

For instance, we use GroupWise and they use Lotus Notes.

I am using Access 2007 (my office is using 2010)
XP-Pro Machine
Please let me know if you need any additional information.

Any ideas?

Thanks,

Task
Private Sub Email_Report_Click()
On Error GoTo Err_Email_Report_Click

If IsNull(Me.UpdateSelect.Value) Then
        MsgBox "Please select a report from the drop down box above before Export.", vbOKOnly
        Exit Sub
    End If
PubIName = Me.UpdateSelect.Column(1)

DoCmd.OpenReport "SitStatReport", acViewPreview, , "SitStatReport.SSRID='" & Me.[SSRID] & "'"

DoCmd.SendObject acSendReport, "SitStatReport", "*.pdf", "email addresses", , , "SitRep Report: " + PubIName

DoCmd.Close acReport, "SitStatReport", acSaveNo

Err_Email_Report_Click:
Exit Sub

End Sub

Open in new window

Private Sub Email_Report_Click()
On Error GoTo Err_Email_Report_Click

If IsNull(Me.UpdateSelect.Value) Then
        MsgBox "Please select a report from the drop down box above before Export.", vbOKOnly
        Exit Sub
    End If
PubIName = Me.UpdateSelect.Column(1)

DoCmd.OpenReport "SitStatReport", acViewPreview, , "SitStatReport.SSRID='" & Me.[SSRID] & "'"

DoCmd.SendObject acSendReport, "SitStatReport", "*.pdf", "email addresses", , , "SitRep Report: " + PubIName

DoCmd.Close acReport, "SitStatReport", acSaveNo

Err_Email_Report_Click:
Exit Sub

End Sub

Open in new window

taskhillAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

taskhillAuthor Commented:
Please forgive the accidental duplication of code above.
0
Jeffrey CoachmanMIS LiasonCommented:
Where did you get that code from?

The correct syntax is:
DoCmd.SendObject acSendReport, "SitStatReport", acFormatPDF, "email addresses", , , "SitRep Report: " & PubIName


Here obviously "email addresses" will be replaced by an actual email address...
0
taskhillAuthor Commented:
Okay, so I changed the syntax to match yours but still nothing.  The report opens and then just sits there, where it use to open the report generate the PDF and attach it to the email.  Now it stops right after opening the report and doesn't follow through with the rest.

I thought that since  you indicated the code was wrong that maybe I didn't even need to generate the report first so I took everything out except your code but that didn't work either.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Jeffrey CoachmanMIS LiasonCommented:
Basic troubleshooting is in order...

Does this happen on all:
Machines
Databases
Reports


Can you send a simple email using something like this:
    DoCmd.SendObject acSendNoObject, , , "SomeEmail@abc.net", , , "No Message Message", "Test of SendNoObject"

Is Outlook set up as your default email client?
0
Sjef BosmanGroupware ConsultantCommented:
If it happens on ALL systems at the same time, I'd check
- the latest XP-updates (wouldn't surprise me if...)
- the network,
- the firewall (port 25),
- and also both servers if there has been incoming mail that's been refused.
0
taskhillAuthor Commented:
Sorry for the long delay, I got caught up on other projects.  I know that never happens to any of you.  Anyhow, on to the questions.

It happens on all machines in the office, all data bases, and all reports.

When attempting to send a simple email using th code provided:

DoCmd.SendObject acSendNoObject, , , "SomeEmail@abc.net", , , "No Message Message", "Test of SendNoObject"

I get the Run-time error '2046'
The command or action "Send Object' isn't available now.

I am looking into sjef bosman's questions now but will need my IT department to check everything other than teh latest XP-updates since we are instructed and do them on an "automatic" schedule.
0
Jeffrey CoachmanMIS LiasonCommented:
<When attempting to send a simple email using th code provided:
DoCmd.SendObject acSendNoObject, , , "SomeEmail@abc.net", , , "No Message Message", "Test of SendNoObject"
I get the Run-time error '2046'
The command or action "Send Object' isn't available now.>
That's odd...
Are you running that line of code alone, or are you inserting it into your existing code?
Run just that in a sub, and let us know what happens...
0
taskhillAuthor Commented:
That is correct.

I am running that code alone in its own sub.

The only thing that I know has changed is we upgraded from Access 2007 to 2010.

I also should add this worked for over a year until recently and then the reports of the error started rolling in just out of the blue.

Thanks,

Task

0
Jeffrey CoachmanMIS LiasonCommented:
Then this is odd.

Try creating a new blank Access 2010 format DB and importing all the objects
0
taskhillAuthor Commented:
Okay, I have creagted a whole new DB and threw some fake data in it.  I then created a button and attached the same code with the same eorror reported.

I am begining to think this is a Windows issue and not an Access issue.

Thoughts?

Task
0
Jeffrey CoachmanMIS LiasonCommented:
I just read this in your origainal post:
    "For instance, we use GroupWise "

The code you are using really wants to see MS Outlook on an MS Exchange Server...

0
taskhillAuthor Commented:
I was lead to believe it doesn't care and uses the default email program and it has worked for a year up until now.
0
Jeffrey CoachmanMIS LiasonCommented:
In some cases yes, but MS continually updates there systems.

What was once possible, ...may not be anymore...
(especially in Access/Office 2010, ...many other apps cannot read this format yet)
0
taskhillAuthor Commented:
The Access 2010 thing might explain my issues but the other users are using the system I originally created using 2007 and they have not upgraded to 2010.
0
Jeffrey CoachmanMIS LiasonCommented:
Post a sample of this DB and I will test it on my system 2007 and 2010
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Again, if it happens to ALL users, and even to some "not even on our IT structure", while your code hadn't changed for years, I'd start checking something else but the code. It is easier to check the code, but the probability that it's there is close to zero, I'd say. What happened to ALL those users at the same time? Were disk policies or user rights changed on the server? An upgrade of some anti-virus or firewall?

Did you add some error reporting lines to the code, just as to find out what error is generated?? Between the lines 16 and 17 I mean?
0
taskhillAuthor Commented:
I will upload a copy of the DB when I get to my destination (traveling today).  I will also look into what sjef_bosman is referring to.  I think he is correct in that it must be something new with either Windows or some other infrastructure.

However, I would love for boag2000 to confirm this by testing it on his system.  Actuallly, stating that, I can test it on my system at home and save him the trouble.

I will get back to you both this PM.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.