Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically linking to dbs on a CD

Status
Not open for further replies.

JesOakley

Programmer
Jan 21, 2008
42
GB
I have a split db, with a number of possible data databases (same design, different data). I wanted to allow my users to select which set of data they wanted to use, so I adapted the Dev Ashish 'fRefreshLinks' code to allow this. When the datasets are all on the local hard drive, this works fantastically well.

Now my customer wants to run the app on the C drive, but with the data on the D drive, so that it can't be modified in any way.

I can use the Linked Table Manager to manually point to the datasets on the D drive, and the app runs fine (albeit more slowly). But when fRefreshLinks is used to do it programatically, it gives error 3051: Jet cannot open dbasename. Already opened exclusively or permissions needed.

It is the line Set dblink = dbengine(0).opendatabase(strdbpath) that is generating the error.

Can anyone help me overcome this?

Thanks in advance.
 
Have a look at this Microsoft article on how to open a database from Read-Only media.
 
Thank you Golom. I'm not sure these were exactly what I was looking for, but the use of qualifiers on the open statements made me look at them for OpenDatabase and when I set the ReadOnly flag and the Options flag both to true, it worked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top