By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,761 Members | 1,879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,761 IT Pros & Developers. It's quick & easy.

How to get quotes wrapped around my variable when constructing an output variable.

P: 167
I am trying to construct a 'Copy' statement in Access 2000 vb that I will actually write out to create a .bat file. My problem is that I need to put quotes around the vcFileFrom and vcFileTo (“vcFileFrom” and “vcFileTo”) to be able to handle having spaces in the file name. I just can not seem to get the correct syntax in my access vb code to get the quotes around the filenames.

I have the following code:

OutRec = "Copy " & vcFileFrom & ", " & vcFileTo & ""

The result of this is:

OutRec = Copy C:\Data\From\DB.mdb, U:\Data\TO\DB.mdb

What I need the results to be is:

OutRec = Copy “C:\Data\From\D B.mdb”, “U:\Data\TO\D B.mdb”

(having the space in the .mdb name).

The first copy statement works as long as my file name does not contain any spaces. So, I am trying to change the copy statement to be able to handle files with spaces.
Can anyone tell me how to get the quotes wrapped around my “FromFile” and “ToFile” variables when trying to build the syntax? I’ve tried several ways and cannot get it to work.

Jan 29 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,287
Two quotes in your string will evaluate to one quote.
Expand|Select|Wrap|Line Numbers
  1. OutRec = "Copy """ & vcFileFrom & """, """ & vcFileTo & """"
Jan 29 '09 #2

P: 167
OMG!! This worked perfectly! I don't know why I have struggled so much to get this seemingly simple thing done.... however, thanks so much for your help!
Jan 29 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.