Synchronizing

L

Linda

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
 
D

Douglas J. Steele

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!
 
L

Linda

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

Douglas J. Steele said:
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)


Linda said:
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
 
D

Douglas J. Steele

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)


Linda said:
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

Douglas J. Steele said:
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)


Linda said:
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
 
L

Linda

That is correct, dbLocal.close is not closing it.

Douglas J. Steele said:
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)


Linda said:
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

Douglas J. Steele said:
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
 
D

Douglas J. Steele

It should.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linda said:
That is correct, dbLocal.close is not closing it.

Douglas J. Steele said:
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)


Linda said:
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
 
L

Linda

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

Douglas J. Steele said:
It should.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linda said:
That is correct, dbLocal.close is not closing it.

Douglas J. Steele said:
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
 
D

Douglas J. Steele

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!)


Linda said:
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

Douglas J. Steele said:
It should.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linda said:
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
 
L

Linda

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!)


Linda said:
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

Douglas J. Steele said:
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
 
D

Douglas J. Steele

Sorry, my typo.

I meant to leave off the DBEngine:

Set dbLocal = OpenDatabase(" \\2003server\junior\replicasynchtest.mdb ")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linda said:
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!)


Linda said:
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
 
L

Linda

Thanks again - I rewrote that statement and it all still works great except
for the
"closing" part. I will continue looking for this solution, but for now at
least the synch part is working good. Thank you so much.

Linda
Douglas J. Steele said:
Sorry, my typo.

I meant to leave off the DBEngine:

Set dbLocal = OpenDatabase(" \\2003server\junior\replicasynchtest.mdb ")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linda said:
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
 
K

krissco

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.

The result of a MsgBox is a long value. Look up MsgBox in the Access
VBA help. You can specify multiple constants to change the look of the
MsgBox (Yes/no, Ok, Ok/Cancel. . . ). The button that the user clicks
will be returned from the MsgBox. Analyze it and close through code.

Dim lngRet as long
lngRet = MsgBox("Hey. Do you wanna close the database?", vbYesNo)

if lngRet = vbYes then
.. . .
else
.. . .
end if


-Kris
 
Top