Creating/Naming a folder using multiple form fields

R

RLConger

Hey Gang, Question here...

I don't have any problems creating and naming a folder based on the
name of one field...

MkDir "C:\TestFolder\" & Me![ClientName]

But what If I wanted to make the folder name "[ClientName]
[Contract#]?

I figured it would be a matter of adding & Me![Contract#] after the
original code, but that doesnt seem to work for me.

Any thoughts on this would be appreciated. I wish that I could
convince the folks I am doing this for that a Client Name OR Contract#
system would work fine, but they want both.

T.I.A.

Ryan
 
F

fredg

Hey Gang, Question here...

I don't have any problems creating and naming a folder based on the
name of one field...

MkDir "C:\TestFolder\" & Me![ClientName]

But what If I wanted to make the folder name "[ClientName]
[Contract#]?

I figured it would be a matter of adding & Me![Contract#] after the
original code, but that doesnt seem to work for me.

Any thoughts on this would be appreciated. I wish that I could
convince the folks I am doing this for that a Client Name OR Contract#
system would work fine, but they want both.

T.I.A.

Ryan

"Doesn't seem to work" doesn't give us any useful information.

The code crashes?
The folder is not correctly named?
Is this code written in a Form's Code sheet or in a Module (a Module
won't recognize the Me! keyword.)?
What, exactly, happens or doesn't happen?

MkDir "C:\TestFolder\" & Me![ClientName] & Me![Contract#]

works for me.
Are you sure [Contract#] is not null for that record?

Try this.
If the code is behing a Form:

Dim FolderName as String
FolderName = Me![ClientName] & Me![Contract#]
MsgBox FolderName
MkDir "C:\TestFolder\" & FolderName

If the code is in a Module:

Dim FolderName as String
FolderName = Forms!FormName![ClientName] & Forms!FormName![Contract#]
MsgBox FolderName
MkDir "C:\TestFolder\" & FolderName


Does the message box display the correct name and number?
Does MkDir work now?
 

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