"File already exists"

B

Bob Barnes

A User in another City is running an Access FE (works fine for me), and is
getting "File already exists" while running this code..

DoCmd.OutputTo acOutputQuery, "PTField", acFormatXLS, _
"C:\Documents and Settings\All Users\Documents\SelfAud\PTField.xls"
M = "The Excel File " & Chr(34) _
& "C:\Documents and Settings\All Users\" _
& "Documents\SelfAud\PTField.xls" & Chr(34) & " Is Ready." & vbCrLf & vbCrLf
M = M & "Open the File?"
O = "Open " & N & "?"
Resp = MsgBox(M, vbQuestion + vbYesNo + 0, O)
If Resp = vbYes Then Application.FollowHyperlink N

When the user clicks the Button a 2nd time, it opens correctly.

Apparently this is consistent behavior each time the User opens the FE and
runs the code.

Thoughts? TIA - Bob
 
D

Daniel Pineault

I may be missing something, but where is your N variable defined?

You reference it's value, but don't seem to define it?
 
D

Daniel Pineault

Also, in your line

Resp = MsgBox(M, vbQuestion + vbYesNo + 0, O)

why have '+ 0' in your buttons if you selected vbYesNo? It's either a user
choice (vbYesNo) or not (0 - vbOkOnly).
 
B

Bob Barnes

0 defaults to "Yes"..256 would default to "No"

Daniel Pineault said:
Also, in your line

Resp = MsgBox(M, vbQuestion + vbYesNo + 0, O)

why have '+ 0' in your buttons if you selected vbYesNo? It's either a user
choice (vbYesNo) or not (0 - vbOkOnly).
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.
 
B

Bob Barnes

You ARE correct..N is a string of the Filename..forgot in the copy &
paste..my fault.

thank you - Bob
 
B

Bob Barnes

Daniel - You're welcome.

And thank you for alerting me to the wireless earlier today. I need to
corner my network co-worker and learn that..will share w/ others here what I
learn from him.

That's the beauty of these Newsgroups..sharing and learning.

Bob
 
T

Tom van Stiphout

On Fri, 8 Feb 2008 17:19:00 -0800, Daniel Pineault

The OP may not have Option Explicit on. A bad decision.
-Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top