Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error 3045 Could not use <db file path> File already in use

121 views
Skip to first unread message

Bob Darlington

unread,
Jun 3, 2012, 9:34:57 PM6/3/12
to
I'm getting the above error message at the line 'Set db = ...' in the
following code (which is called from the autoexec macro before anything else
happens).

Dim ws as Workspace, db as DAO.Database
set ws = Workspaces(0)
set db = Currentdb

If I remove the 'set ws = ...' line, then the message doesn't appear.
But I need the ws for a transactions routine which follows in the same
function.
I've tried various options for 'set db = ' but with no success.
I'm using similar code throughout the database without a problem.
Can anyone help?

--
Bob Darlington
Brisbane


Patrick Finucane

unread,
Jun 4, 2012, 9:42:09 AM6/4/12
to
At this link, http://msdn.microsoft.com/en-us/library/bb220951(v=office.12).aspx,
it uses:
DBEngine.Workspaces(0)



Ron Paii

unread,
Jun 4, 2012, 2:51:31 PM6/4/12
to


"Bob Darlington" <b...@notheredpcman.com.au> wrote in message
news:4fcc10b9$0$2189$c3e8da3$9f40...@news.astraweb.com...
set DB = ws.Databases(0)

Bob Darlington

unread,
Jun 5, 2012, 3:59:08 AM6/5/12
to
Thanks Ron.
I used set ws = DBEngine.Workspaces(0) and it all works fine.



--
Bob Darlington
Brisbane
"Ron Paii" <No...@none.com> wrote in message
news:jqj03l$gdi$1...@dont-email.me...
0 new messages