Comple Error "Argument Not Optional" when calling a Function

R

robboll

Hello! I am having trouble with variables. When I run this
function:

Call MyFunction("C:\dm\documents\one.txt", "D:\DestinationDir
\onecopy.txt")

it works like a champ.



But when I replace the hard code with variables:

Call MyFunction("C:\dm\documents\" & fileName & ", " & "D:
\DestinationDir\" & CaseStamp & ")"

.. . . it bombs with the error "Argument Not Optional". I've tried
several variations of this without any success.

Any idea as to why it isn't accepting variables? I did check the
variabes with debugger and they match the hard code.

Thanks for any suggestions,

RBollinger
 
D

Douglas J. Steele

You're mistakenly concatenating the comma to the two other values. It should
be:

Call MyFunction("C:\dm\documents\" & fileName, "D:\DestinationDir\" &
CaseStamp)
 
J

Jeanette Cunningham

Hi,
this part
--> "C:\dm\documents\" & fileName & "
is the problem
It will resolve to "C:\dm\documents\one.txt""
Note the extra double quote at the end

Change to "C:\dm\documents\" & fileName


Jeanette Cunningham
 
R

robboll

Thanks for the help!


You're mistakenly concatenating the comma to the two other values. It should
be:

Call MyFunction("C:\dm\documents\" & fileName, "D:\DestinationDir\" &
CaseStamp)

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)














- Show quoted text -
 

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