question about Workspaces(0).OpenDatabase

  • Thread starter Thread starter rocio
  • Start date Start date
R

rocio

I never developed and used Acess in the past, now I have to decode a program written in VB4 that accesses an Access db. I installed the program in a computer running windows server 2000 only (this is, ther is no Office programs installed), and when I try running the code it crashes with the message "File not Found", then another error message thta I can track from the src code of this application.

It seems to crash when trying to load the main form of the app, Form_Load() . The statements here are:

' open the assessment number and name database
Set dbPhotobase = Workspaces(0).OpenDatabase(GetDatabasePath & "mydbase.mdb")
Set rsPhotoval = dbPhotobase.OpenRecordset("photoval", dbOpenDynaset)
Set rsImages = dbPhotobase.OpenRecordset("images", dbOpenDynaset)

' create the images directory if it does not exist
On Error Resume Next
MkDir Left$(GetImagePath, Len(GetImagePath) - 1)

' this is static
usrCurrentImage.strPath = GetImagePath
Exit Sub
err_Form_Load:
' unload the program if the database is not accessible
MsgBox "Could not start Photobase: " & Err.Description, vbCritical, APP_TITLE
End

the error message I get (that comes from the err_Form section above) is:
Could not start Photobase: object required

my guess is, since I do not have Microsoft Office installed in this computer, maybe I'm missing some Access objects that will enable Workspaces to open this database? Or, do I need to have Access install in order to run this piece of code?

Hope you can help on this one.....
 
Step thru the code line by line, by pressing Control G
the immediate window will show type ?GetDatabasePath in
order 2 get the value of GetDatabasePath...Make sure the
database is at that location...This is just a start
-----Original Message-----
I never developed and used Acess in the past, now I have
to decode a program written in VB4 that accesses an Access
db. I installed the program in a computer running windows
server 2000 only (this is, ther is no Office programs
installed), and when I try running the code it crashes
with the message "File not Found", then another error
message thta I can track from the src code of this
application.
It seems to crash when trying to load the main form of
the app, Form_Load() . The statements here are:
' open the assessment number and name database
Set dbPhotobase = Workspaces(0).OpenDatabase
(GetDatabasePath & "mydbase.mdb")
Set rsPhotoval = dbPhotobase.OpenRecordset ("photoval", dbOpenDynaset)
Set rsImages = dbPhotobase.OpenRecordset("images", dbOpenDynaset)

' create the images directory if it does not exist
On Error Resume Next
MkDir Left$(GetImagePath, Len(GetImagePath) - 1)

' this is static
usrCurrentImage.strPath = GetImagePath
Exit Sub
err_Form_Load:
' unload the program if the database is not accessible
MsgBox "Could not start Photobase: " &
Err.Description, vbCritical, APP_TITLE
End

the error message I get (that comes from the err_Form section above) is:
Could not start Photobase: object required

my guess is, since I do not have Microsoft Office
installed in this computer, maybe I'm missing some Access
objects that will enable Workspaces to open this database?
Or, do I need to have Access install in order to run this
piece of code?
 
This is more of a VB question than Access. You do not need Access at all to open an Access database in VB. You DO however need a reference to DAO (I don't know what version VB4 used) to be able to open a workspace and database object.

I'd try asking this on a VB Newsgroup.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

I never developed and used Acess in the past, now I have to decode a program written in VB4 that accesses an Access db. I installed the program in a computer running windows server 2000 only (this is, ther is no Office programs installed), and when I try running the code it crashes with the message "File not Found", then another error message thta I can track from the src code of this application.

It seems to crash when trying to load the main form of the app, Form_Load() . The statements here are:

' open the assessment number and name database
Set dbPhotobase = Workspaces(0).OpenDatabase(GetDatabasePath & "mydbase.mdb")
Set rsPhotoval = dbPhotobase.OpenRecordset("photoval", dbOpenDynaset)
Set rsImages = dbPhotobase.OpenRecordset("images", dbOpenDynaset)

' create the images directory if it does not exist
On Error Resume Next
MkDir Left$(GetImagePath, Len(GetImagePath) - 1)

' this is static
usrCurrentImage.strPath = GetImagePath
Exit Sub
err_Form_Load:
' unload the program if the database is not accessible
MsgBox "Could not start Photobase: " & Err.Description, vbCritical, APP_TITLE
End

the error message I get (that comes from the err_Form section above) is:
Could not start Photobase: object required

my guess is, since I do not have Microsoft Office installed in this computer, maybe I'm missing some Access objects that will enable Workspaces to open this database? Or, do I need to have Access install in order to run this piece of code?

Hope you can help on this one.....
 
Thanks! I'll ask to the vb groups. At least, I know I do not need Access installed to run this program.


This is more of a VB question than Access. You do not need Access at all to open an Access database in VB. You DO however need a reference to DAO (I don't know what version VB4 used) to be able to open a workspace and database object.

I'd try asking this on a VB Newsgroup.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

I never developed and used Acess in the past, now I have to decode a program written in VB4 that accesses an Access db. I installed the program in a computer running windows server 2000 only (this is, ther is no Office programs installed), and when I try running the code it crashes with the message "File not Found", then another error message thta I can track from the src code of this application.

It seems to crash when trying to load the main form of the app, Form_Load() . The statements here are:

' open the assessment number and name database
Set dbPhotobase = Workspaces(0).OpenDatabase(GetDatabasePath & "mydbase.mdb")
Set rsPhotoval = dbPhotobase.OpenRecordset("photoval", dbOpenDynaset)
Set rsImages = dbPhotobase.OpenRecordset("images", dbOpenDynaset)

' create the images directory if it does not exist
On Error Resume Next
MkDir Left$(GetImagePath, Len(GetImagePath) - 1)

' this is static
usrCurrentImage.strPath = GetImagePath
Exit Sub
err_Form_Load:
' unload the program if the database is not accessible
MsgBox "Could not start Photobase: " & Err.Description, vbCritical, APP_TITLE
End

the error message I get (that comes from the err_Form section above) is:
Could not start Photobase: object required

my guess is, since I do not have Microsoft Office installed in this computer, maybe I'm missing some Access objects that will enable Workspaces to open this database? Or, do I need to have Access install in order to run this piece of code?

Hope you can help on this one.....
 
Back
Top