Hi Folks,
I'm in the early stages of developing a new routine and the first thing I'm doing is opening a Microsoft Access DB (.accdb). There is a form load event that takes place when the file is open which looks to pull in a jpg image located on a network drive (T:\Images\no-image.jpg). When I open the DB with a manual double click, I provide login credentials and move on without error. When I try to launch the DB from my script the DB opens, I'm presented with the login dialog, I provide the credentials in my script and the DB opens. BUT, it opens with a Microsoft Visual Basic error 2220... "your DB can't open the file 'T:\Images\no-image.jpg'.
I've tried relaunching MacroScheduler as Admin, I've tried placing my Access DB in a folder on my C drive, at the root of my C drive, and desktop. I've tried RunProgram instead of ExecuteFile. I've checked file and folder permissions on the DB and image folder. I've run out of things to try.
Anyone else run into a problem like this and what did you do to fix it?
MS Access VB Error 2220
Moderators: Dorian (MJT support), JRL
Re: MS Access VB Error 2220
I've never run into that, but have you tried RunProgram using that setting?To run as admin, set RP_ADMIN to 1.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: MS Access VB Error 2220
Also, what about making sure the file exists using VB before you open the db and before you get the file? That way, you can narrow it down to path or permissions. You ought to assume your assumption that it obviously knows the path and display everything that you can.
You may also wish to run the dos whoami command to see the user that's running the db code.
You may also wish to run the dos whoami command to see the user that's running the db code.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: MS Access VB Error 2220
Thanks mighty. I've tried RP_ADMIN=1 and I've tried it with RunProgram. I know the file exists and only have this issue when launching from the macro. I've managed to work around it by adding a bit of code to a form load event...
Dim pic As String
pic = "T:\Drop-Images\Attached\no-image.jpg"
If Len(Dir(pic)) > 1 Then
Me.Image4.Picture = pic
Else
Me.Image4.Picture = ""
Me.Image4.Requery
End If
It works to suppress the error but I've like to get to the root of the issue if nothing than for my own peace of mind.
Dim pic As String
pic = "T:\Drop-Images\Attached\no-image.jpg"
If Len(Dir(pic)) > 1 Then
Me.Image4.Picture = pic
Else
Me.Image4.Picture = ""
Me.Image4.Requery
End If
It works to suppress the error but I've like to get to the root of the issue if nothing than for my own peace of mind.