Thanks Doug, I removed the parens, and tried the other things you
suggested -
it still will not close. I don't see a difference in what you suggested
for
opening the db and how it is written already - what am I missing?
The Msgbox works fine - question: If I write a msg telling user to close
database and they click on the ok button - can I put a close command on
that
button (don't know how to code that)??? - don't really want to use this
kind
of work-around, but trying to save some keystrokes for the folks.
What if I identify the path of the db that I want to close? As you can
tell, I am a real novice. Thanks again for any help.
Douglas J. Steele said:
One thing that strikes me is how you're opening the database.
See whether
Set dbLocal =DBEngine.OpenDatabase("
\\2003server\junior\replicasynchtest.mdb ")
makes a difference.
As well, the parentheses around the database name in the Synchronize
method
aren't required (and are actually incorrect):
dbLocal.Synchronize "C:\replicasynchtest.mdb"
You could also try adding DBEngine.Idle before you close, just to ensure
all
the work's been done.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Ok I tried again and still does not close the db. Does close need to
be
in
quotes or any special keys? Does the next line of code: Set dbLocal =
Nothing perhaps have something to do with it not closing? Thanks for
your
help
Linda
:
It should.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
That is correct, dbLocal.close is not closing it.
:
Use MsgBox to give them a message.
Are you saying that dbLocal.Close isn't closing it?
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Thank you Douglas - it worked great! One more thing. Can you
tell
me
how
to
expand the code to give a message to user that db has been
synchronized
or
simply close the db?
Thanks again
:
Both the OpenDatabase and the Synchronize methods are expecting
file
paths.
That means strings.
Dim dbLocal As DAO.Database
Set dbLocal = DBEngine.OpenDatabase("
\\2003server\junior\replicasynchtest.mdb ")
dbLocal.Synchronize ("C:\replicasynchtest.mdb")
dbLocal.Close
Set dbLocal = Nothing
End Sub
Note that the spaces in the OpenDatabase method aren't required.
Outlook
Express removed them when I didn't put them!
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
I am attaching an event procedure to a button to synchronize
db.
I
am
receiving a run-time error:Run-time error 2465
MS Office Access can't find this field 'l' referred to in
your
expression.
Note: 'l' is actually shown as a straight line.
Here is the code I have written
Private Sub Option19_Click()
Dim dbLocal As DAO.Database
Set dbLocal =
DBEngine.OpenDatabase([\\2003server\junior\replicasynchtest.mdb])
dbLocal.Synchronize ([C:\replicasynchtest.mdb])
dbLocal.Close
Set dbLocal = Nothing
End Sub
Any suggestions