0

I have a web application that links to Microsoft Access and opens one of five databases depending on which button is clicked. The purpose of the web app is to open an instance of the database for an employee to use the forms that we've coded in the database itself.

I coded it on my machine in Visual Web Developer 2008 and it works exactly as expected when ran on my machine, but when I move the files to a laptop that I need to use to present the web application to the people that need to approve them it stops working. This laptop also has Visual Studio 2008 and I'm able to open and run the web app just fine, but I get the following error when any of the five buttons are clicked:

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

A very shortened snippet of the VB code is below. The last line is where the error is thrown. The databases are all on internal network drives and I can open them manually on the laptop by navigating through the folders, so it's not that they aren't there or that they actually are corrupt. Any ideas?

Dim db As Access.Application

db = New Access.Application
db.OpenCurrentDatabase("Path As String Here")
4
Contributors
11
Replies
12
Views
7 Years
Discussion Span
Last Post by Lusiphur
0

Umm don't you want to use Connection strings?

Sorry can you elaborate?

I want to actually open an instance of Microsoft Access, not just a connection to the database. All the changes that a user needs to make to the database will be done in forms that have already been coded in the Access Database itself. The internal website I'm working on is just a front end that lets the user quickly select which of the 5 or so databases he/she would like to see. It works exactly as expected on 2 of the 3 machines I've tested, but I get this error on the third one.

Hi

Go thru the links ,this might help you!!!

http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/6adca20b-649f-41a4-8fa1-09534882d76c

http://forums.asp.net/t/675515.aspx

Mark as solved if it helps you!!!

Thank you for trying, but I had found both of those as well as quite a few more threads like those before posting here. None were any help.

0

What error do you get can you paste the code?

The error message is in the original post, as well as a shortened version of the code. I'll repost the error text here though, as well as a full version of the code. The error is thrown at line 14. I removed the actual path and the actual usernames from the code. Again, on 2 of 3 test machines I do not get this error and the site works exactly as expected.

ERROR MESSAGE = "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

On Error GoTo errHandler

        Dim db As Access.Application
        Dim Authorized() As String
        Dim Found As Boolean

        Authorized = Split("<Authorized Usernames", ";")

        Found = InStr(1, vbNullChar & Join(Authorized, vbNullChar) & vbNullChar, vbNullChar & _
        NameCheck.LogIn & vbNullChar) > 0

        If Found Then
            db = New Access.Application
            db.OpenCurrentDatabase("<DB Path on Internal Server>")

            db.Visible = True
            Response.Write("<script language='javascript'> { window.open('','_self',''); window.close(); }</script>")
            Exit Sub
        Else
            Err.Raise(50000)
        End If

errHandler:
        If Err.Number = 5273 Or Err.Number = 7866 Or Err.Number = 1004 Then
            MsgBox(NameCheck.FirstName & ", There was an error opening the report. " & _
                   "You may not have access to the folder the report is in.", _ 
                   vbInformation + vbSystemModal, "CTQ Track - Folder Access Error")
        ElseIf Err.Number = 50000 Then
            MsgBox(NameCheck.FirstName & ", you aren't authorized to perform maintenance on this database.", _
                   vbInformation + vbSystemModal, "CTQ Track - Database Access Error")
        Else
            MsgBox(Err.Description, vbInformation + vbSystemModal, "CTQ Track - Error")
        End If

Edited by leverin4: n/a

0

OMG, this is what I get for not reading correctly,

What are the chances that machine itself is the problem?

I mean you tried it on two other machines and it doesn't work on one of the machines.

Then it's most likely a problem with that machine, can you copy and paste the access file on that machine and try to open it normally?

Edited by finito: n/a

0

OMG, this is what I get for not reading correctly,

What are the chances that machine itself is the problem?

I mean you tried it on two other machines and it doesn't work on one of the machines.

Then it's most likely a problem with that machine, can you copy and paste the access file on that machine and try to open it normally?

Haha, no problem.

The laptop is on the same network, so I did navigate through the network folders in windows explorer to the folder that has the database in it. Doing this, I was able to open the database on the laptop just fine. I only have the problem when I try to open it with my website.

I'm worried that 1/3 of the users will get the same error when I publish it and go live. That's almost 200 people.

0

Honestly I would try and see if I can confirm that it's the machine itself.

Can you try and run a LiveCd and Virtual PC on that machine? Just to be extra sure.

0

Honestly I would try and see if I can confirm that it's the machine itself.

Can you try and run a LiveCd and Virtual PC on that machine? Just to be extra sure.

I'm only an intern, so I doubt they'd let me do that with a company laptop, but I'll look into it and see what I can do.

0

Here is an article dealing with cross compatibility of COM versions. Might have something to do with your scenario if perhaps there's a different version of Access on your laptop than there is on your other 2 test units.

This link also relates to varying versions of Access and related COM libraries required.

Based on your post, the VB application uses Access 12.0 Object Library to Communicate with Access 2007. If you would like to use the related objects in 2003 version, you need to change or add the reference for Access 11.0 Object Library. Furthermore, you need to make sure the Access 2007/2003 is installed on the target computer you would like to run the application.

I believe the issue isn't with the database being connected to but the COM library being used to access the local version of Access on the machine the site is being run on. What you may want to do is confirm the installed versions on the various machines that the web-app is going to be run on to ensure that all the required COMs are being supported in your app.

Hope this helps ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.