Problem when Opening Access (1 Viewer)

mcgilla

Registered User.
Local time
Today, 12:48
Joined
Sep 17, 2010
Messages
31
Hello,

I'm putting this one in the General because the problem could one of many different areas. I'm using a query, one data entry form and a form with List, vba with Microsoft Outlook Object Library code and it is checked in the references.

First, I've created a query that checks for open tasks. I use that query on a blank form with a list box that uses the query to fill it if there are open tasks. And if there are tasks, send an email to the assigned person.

Here's the flow of things.

1. Data Entry form, automatically creates an open task item if any edits have been done.
2. When form is closed, in the unload i open my second form with the list box and use the following code if the task list is populated. Otherwise it does nothing.

Code:
Me.Visible = False
 
 
 
Dim appOutlook as Outlook.Application, _
      mailOutlook as Outlook. MailItem
 
Set appOutlook = CreateObject("Outlook.Application")
Set mailOutlook = appOutlook.createItem(olMailItem)
 
With mailOutlook
    .BodyFormat = olFormatPlain
    .To = "email address"
    .Subject = "Automated Message"
    .Body  = "This is an automated message and you have tasks to complete"
    .DeleteAfterSubmit = True
    .Send
End With
 
Set appOutlook = Nothing
Set mailOutlook = Nothing

I'm working with Windows 7, Office 2010. I've used all of this in other areas before. The email, I've used in Excel to send notices to people. The checking of the list I've used in Access before. I didn't think there would be a problem.

So after I have built all of this, I test it and it works fine. I get an email message in my inbox (since I'm the test guy) and everything seems great. I then close Access. And when I open it, I get a "Microsoft Access Has Stopped Working" prompt. And then I have to close access. I can bypass my startup and it will open and show me the objects in the database. If I try to Edit the Form with the ListBox, I will get the same message.

Any search for this error seems to direct me towards something completely unrelated to my problem. I'm using and developing with up to date software and operating system. I'm using parts of these methods in the database, the new thing to the database is the Outlook Objects, but they do work in my Excel sheet just fine.

Thanks for any help. Hopefully I've given enough detail.
Ed
 

boblarson

Smeghead
Local time
Today, 09:48
Joined
Jan 12, 2001
Messages
32,059
Sounds like it could either be a corruption issue or a VBA Synch issue.

First, make a copy of the database file just as a backup and then run a DECOMPILE (see here for more about that: http://www.granite.ab.ca/access/decompile.htm )

If that doesn't work, try importing everything into a new, blank database shell (make sure you import and don't just copy and paste).
 

mcgilla

Registered User.
Local time
Today, 12:48
Joined
Sep 17, 2010
Messages
31
Sounds like it could either be a corruption issue or a VBA Synch issue.

First, make a copy of the database file just as a backup and then run a DECOMPILE (see here for more about that: http://www.granite.ab.ca/access/decompile.htm )

If that doesn't work, try importing everything into a new, blank database shell (make sure you import and don't just copy and paste).

I'll try the decompile and see what it says. I did try to import that new second form into a blank database and the same thing happened in the second database. That's why I was thinking my outlook code might be the cause of the issue. But now I can't even import that form, or edit it in the original database. (Glad I keep a backup of my latest working copy).
 

mcgilla

Registered User.
Local time
Today, 12:48
Joined
Sep 17, 2010
Messages
31
Sounds like it could either be a corruption issue or a VBA Synch issue.

First, make a copy of the database file just as a backup and then run a DECOMPILE (see here for more about that: http://www.granite.ab.ca/access/decompile.htm )

If that doesn't work, try importing everything into a new, blank database shell (make sure you import and don't just copy and paste).

Bob, the decompile worked like a charm.

Thanks a bunch. This one had me very confused because I had imported and modified my other forms and then had the error. Then I figured I should just create it from scratch, and the error happened again. Decompile worked great and the functionality is there that I need.
 

Users who are viewing this thread

Top Bottom