Answered by:
.NET Unhandled Exception 0x800A9C68 VB 2008 Express / Access 2007 Runtime

Question
-
All,
I am running into a problem with a VB2008 Express Application that uses a MS Access database.
The target machine is WinXP, 32 Bit SP3 WITH the Access 2007 Runtme installed.
Needless to say, this code works fine on the development system which is Win7, 64bit with a full copy of Access 2007 installed.
Very simply, the VB program calls a function inside the Access DB to print a report.
The VB Progam Code is:
<pre lang="x-vbnet">Const acExit As Int32 = 2 Dim objAccess1 As Object ' Open the run-time instance and database... ' Code for launching Access runtime goes below If SystemType = 32 Then Shell("c:\Program Files\Microsoft Office\Office12\msaccess.exe " & Chr(34) & "C:\SCDBv4\Data\SCDBData.mdb" & Chr(34)) Else Shell("c:\Program Files (x86)\Microsoft Office\Office12\msaccess.exe " & Chr(34) & "C:\SCDBv4\Data\SCDBData.mdb" & Chr(34)) End If objAccess1 = GetObject("C:\SCDBv4\Data\SCDBData.mdb") objAccess1.Run("PrintIt1") objAccess1.Quit(acExit) objAccess1 = Nothing
Inside the Access DB, the PrintIt1 Function looks like this:
Option Compare Database Option Explicit Public Sub PrintIt1() Dim dbInUse As DAO.Database Dim rsInUse As DAO.Recordset Set dbInUse = CurrentDb DoCmd.OutputTo acOutputReport, "Mint Single Detail Report", acFormatPDF, "C:\temp\test.PDF" dbInUse.Close End Sub
As far as the program goes, it is stored in a folder along with Interop.ADODB.DLL and Microsoft.Office.Interop.Access.dll.
Recall, the traget (problem) problem machine as Access 2007 Runtime installed. In addition, .NET 2 SP 2, .NET 3 SP2 and .NET 3.5 SP1 are all installed.
Any help or suggesions would be most helpful and will be tested.
Roger
- Moved by Andrew.Wu Friday, May 20, 2011 10:39 AM (From:.NET Framework Setup)
Saturday, May 14, 2011 10:24 PM
Answers
-
All,
Afer much trial and error, this is the working code (in the Access Module)
Public Sub PrintIt1(ReportNameToPrint As String) Dim dbInUse As DAO.Database Dim rsInUse As DAO.Recordset Set dbInUse = CurrentDb DoCmd.OpenReport ReportNameToPrint, acViewPreview MsgBox ("The program will now create your report and save it as:" + Chr(10) + Chr(13) + "C:\SCDBv4\Reports\" + ReportNameToPrint + ".pdf") DoCmd.OutputTo acOutputReport, ReportNameToPrint, acFormatPDF, "C:\SCDBv4\Reports\" + ReportNameToPrint + ".pdf" dbInUse.Close End Sub
Roger
- Marked as answer by REdelman Wednesday, June 1, 2011 8:05 PM
Wednesday, June 1, 2011 8:05 PM
All replies
-
The exception is caused by your application, not the framework itself.
The best suggestion I can offer you is to post your question in a topical VB developer forum.
The topic of this forum is .NET Framework installation.
You'll find the VB developer forums here:
http://social.msdn.microsoft.com/Forums/en-US/category/visualbasic
- Edited by pvdg42 Saturday, May 14, 2011 11:43 PM add info
Saturday, May 14, 2011 11:42 PM -
I would like to agree with you HOWEVER, the fact that the app runs on the development system makes me think that the app works. No exceptions are thrown on the dvelopment system which makes me think it has to do with either the external components like .net or access runtime or the modules that are deployed.
Again, I made the assumption that it's not the code since it runs just fine on the development system.
Roger
Sunday, May 15, 2011 12:03 AM -
Good point. When you built the project on the Win 7 x64 machine, was the target CPU "Any CPU"?
You might try changing the target CPU to "x86" to see if that helps.
Sunday, May 15, 2011 2:44 PM -
Hi Roger,
In order to eliminate the .NET Framework corrupt issue, I would suggest you to verify the .NET Framework in the target machine with .NET Framework Setup Verification Tool.
If it reports verify failed, please post the verificaiton logs back here for further support.
If this tool reports verify successfully, then this issue should be related with neither the project itself or Access runtime. You are more likely to get more efficient response for these issues in the dedicate forum below:
If you have any concerns, please feel free to let me know.
Best Regards,
Andrew Wu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Tuesday, May 17, 2011 9:14 AM -
Hi Roger,
I find you've opened a new post in the Visual Basic forum: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/81abdff2-d90a-483c-a4e0-3c7eb7952026/.
Therefore, I'm going to move this post to the Off-Topic forum, you can focus on the other post to resolve this issue.
Thanks for your understanding.
Best Regards,
Andrew Wu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Friday, May 20, 2011 10:41 AM -
All,
Afer much trial and error, this is the working code (in the Access Module)
Public Sub PrintIt1(ReportNameToPrint As String) Dim dbInUse As DAO.Database Dim rsInUse As DAO.Recordset Set dbInUse = CurrentDb DoCmd.OpenReport ReportNameToPrint, acViewPreview MsgBox ("The program will now create your report and save it as:" + Chr(10) + Chr(13) + "C:\SCDBv4\Reports\" + ReportNameToPrint + ".pdf") DoCmd.OutputTo acOutputReport, ReportNameToPrint, acFormatPDF, "C:\SCDBv4\Reports\" + ReportNameToPrint + ".pdf" dbInUse.Close End Sub
Roger
- Marked as answer by REdelman Wednesday, June 1, 2011 8:05 PM
Wednesday, June 1, 2011 8:05 PM