comma as concatenation operator ?

  • Thread starter Thread starter R. Choate
  • Start date Start date
R

R. Choate

Here is a snippet of some extremely annoying code:

"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & strDir & Left(Sheets("Home").cboMonth, 3) &
"" _
, _
"ls;Mode=Share Deny Write;Extended Properties=""HDR=NO;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet
OLEDB:Databas" _
, _
"e Password="""";Jet OLEDB:Engine Type=35;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Global Bu" _
, _
"lk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt
Database=False;Jet" _
, _
" OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False" _

I hope your newsreader doesn't make this worse by wrapping, but my question is this: each line of this code (written by the macro
recorder) ends with a line continuation character and then the next line is simply a comma and another continuation character. The
only way this makes sense to me is if the comma is being used instead of an ampersand for a concatenation operator. I have never
heard of this before and couldn't find anything about it. Is this for real? The answer is important because I can't use the
auto-generated code as-is. Also, it looks stupid, cutting words in half and generating a nearly blank row before continuing. Why
would it do that?

Most importantly, please tell me if the comma is useable as a concatenation operator.

Thank you in advance !
 
The comma is the argument separator for the function. It has nothing to do
with concatenate. The under score is the new line extender. The & is a
concatenate operator. You can also use + as a concatenate operator but it is
not recommended. What you have there is just really long function arguments...
 
That is what I thought as well, but it doesn't make any sense that any argument within an array or function might include a fraction
of a word or a fraction of a file extension, as is done in this case. Also, it seems clear that the semicolon is being used to
separate the arguments. Additionally, since I didn't get a reply before I pretty much had to have one, I went ahead and wrote my
code based on stuff similar to what you saw in my post, and used the comma at the end of a line where I would normally use the "&",
and it worked. I couldn't believe it.
--
RMC,CPA


The comma is the argument separator for the function. It has nothing to do
with concatenate. The under score is the new line extender. The & is a
concatenate operator. You can also use + as a concatenate operator but it is
not recommended. What you have there is just really long function arguments...
 
Addendum: I know you sent a reply less than an hour after my post. Sometimes in the stress of a situation, I'm sure you've been
there, 45 minutes seems like 4 and 1/2 hours. I probably closed my newsreader after about 30 minutes because I had gotten it to work
(finally) and couldn't wait to see what was said, if anybody ended up coming in with a reply.

Thanks for your help. I hope I didn't seem to confusing.

Richard
--
RMC,CPA


The comma is the argument separator for the function. It has nothing to do
with concatenate. The under score is the new line extender. The & is a
concatenate operator. You can also use + as a concatenate operator but it is
not recommended. What you have there is just really long function arguments...
 

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

Back
Top