PC Review


Reply
Thread Tools Rate Thread

Create Folder Named [Field1] & " " & [Field2]

 
 
=?Utf-8?B?QmV2ZXJseTc2?=
Guest
Posts: n/a
 
      23rd Jan 2006
Is there a way to click a button on a form and have it combine two fields on
the form into a file name and use that file name to make a new file folder in
a designated directory? Every time I get a new physical file, I have to make
a folder on the network. Sometimes I forget, but I always enter all the file
data into my access form.

Please advise.

Thank you.
--
Sincerely,
Beverly76
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      23rd Jan 2006
"Beverly76" <(E-Mail Removed)> wrote in message
news:4A5DAD3D-F4A8-4508-BA4C-(E-Mail Removed)
> Is there a way to click a button on a form and have it combine two
> fields on the form into a file name and use that file name to make a
> new file folder in a designated directory? Every time I get a new
> physical file, I have to make a folder on the network. Sometimes I
> forget, but I always enter all the file data into my access form.


Sure, though the need to do this seems rather strange. The basic code
would be something like this:

'----- start of example code -----
Private Sub cmdMakeFolder_Click()

Const conBaseFolder As String = "C:\Some Path\Some Folder\"
' this would be the folder you want to create new folders in.

Dim strNewFolder As String

strNewFolder = _
conBaseFolder & _
Me![Field1] & " " & Me![Field2]

If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
MsgBox "The folder '" & strNewFolder & "' already exists!"
Else
MkDir strNewFolder
End If

End Sub
'----- end of example code -----

Note that all the folders higher up in the hierarchy must already exist
before you can create a new folder.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
=?Utf-8?B?QmV2ZXJseTc2?=
Guest
Posts: n/a
 
      24th Jan 2006
Thanks! Amazingly - this worked perfectly and immediately. This comes in
handy because one of my fields is a six digit number. By creating the file
folder automatically, it ensures that I don't mistype the number and it keeps
me from having to look it up later.
--
Sincerely,
Beverly76


"Dirk Goldgar" wrote:

> "Beverly76" <(E-Mail Removed)> wrote in message
> news:4A5DAD3D-F4A8-4508-BA4C-(E-Mail Removed)
> > Is there a way to click a button on a form and have it combine two
> > fields on the form into a file name and use that file name to make a
> > new file folder in a designated directory? Every time I get a new
> > physical file, I have to make a folder on the network. Sometimes I
> > forget, but I always enter all the file data into my access form.

>
> Sure, though the need to do this seems rather strange. The basic code
> would be something like this:
>
> '----- start of example code -----
> Private Sub cmdMakeFolder_Click()
>
> Const conBaseFolder As String = "C:\Some Path\Some Folder\"
> ' this would be the folder you want to create new folders in.
>
> Dim strNewFolder As String
>
> strNewFolder = _
> conBaseFolder & _
> Me![Field1] & " " & Me![Field2]
>
> If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
> MsgBox "The folder '" & strNewFolder & "' already exists!"
> Else
> MkDir strNewFolder
> End If
>
> End Sub
> '----- end of example code -----
>
> Note that all the folders higher up in the hierarchy must already exist
> before you can create a new folder.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>

 
Reply With Quote
 
=?Utf-8?B?RWJpdGFyaQ==?=
Guest
Posts: n/a
 
      21st Jun 2007
This information that you posted was very helpful to me and I have
implemented it in my database.

Now I want to take this one step further and place the address information
for the newly created (e.g. C:Folder\address\) into a text box field.

The rationale is so that the user can see the location of the folder that
has just been created.

Can you help me with this?

Thanks

"Dirk Goldgar" wrote:

> "Beverly76" <(E-Mail Removed)> wrote in message
> news:4A5DAD3D-F4A8-4508-BA4C-(E-Mail Removed)
> > Is there a way to click a button on a form and have it combine two
> > fields on the form into a file name and use that file name to make a
> > new file folder in a designated directory? Every time I get a new
> > physical file, I have to make a folder on the network. Sometimes I
> > forget, but I always enter all the file data into my access form.

>
> Sure, though the need to do this seems rather strange. The basic code
> would be something like this:
>
> '----- start of example code -----
> Private Sub cmdMakeFolder_Click()
>
> Const conBaseFolder As String = "C:\Some Path\Some Folder\"
> ' this would be the folder you want to create new folders in.
>
> Dim strNewFolder As String
>
> strNewFolder = _
> conBaseFolder & _
> Me![Field1] & " " & Me![Field2]
>
> If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
> MsgBox "The folder '" & strNewFolder & "' already exists!"
> Else
> MkDir strNewFolder
> End If
>
> End Sub
> '----- end of example code -----
>
> Note that all the folders higher up in the hierarchy must already exist
> before you can create a new folder.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jun 2007
In news:EDF9C968-07D1-4E03-861F-(E-Mail Removed),
Ebitari <(E-Mail Removed)> wrote:
> This information that you posted was very helpful to me and I have
> implemented it in my database.
>
> Now I want to take this one step further and place the address
> information for the newly created (e.g. C:Folder\address\) into a
> text box field.
>
> The rationale is so that the user can see the location of the folder
> that has just been created.
>
> Can you help me with this?


It should be quite simple. Where before you had this:

> If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
> MsgBox "The folder '" & strNewFolder & "' already exists!"
> Else
> MkDir strNewFolder
> End If


.... now you'd have this:

If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
MsgBox "The folder '" & strNewFolder & "' already exists!"
Else
MkDir strNewFolder
Me!txtFolderPath = strNewFolder
End If

That assumes that "txtFolderPath" is the name of the text box where you
want to display the name of the folder, and also that this code is
running on the form that contains that text box.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
=?Utf-8?B?RWJpdGFyaQ==?=
Guest
Posts: n/a
 
      28th Jun 2007
Thanks for the information - it was very helpful.

Now I want to launch the folder so that people can save files to it.

I am using the following code:

Application.FollowHyperlink "O:\EWGPP\NA-233 Task Order & Invoice Tracking\"
& "Invoice" & " " & [Invoice Number], True

This works and opens the folder, however, when I copy a file to the folder
it does not show up until I go out of the folder and go back in. It does not
seem to be opening the folder with the right settings because I can't see
files immediately when I copy them to the opened folder. Is there a way to
open a folder in a setting that automatically refreshes when a file is saved
to it?


"Dirk Goldgar" wrote:

> In news:EDF9C968-07D1-4E03-861F-(E-Mail Removed),
> Ebitari <(E-Mail Removed)> wrote:
> > This information that you posted was very helpful to me and I have
> > implemented it in my database.
> >
> > Now I want to take this one step further and place the address
> > information for the newly created (e.g. C:Folder\address\) into a
> > text box field.
> >
> > The rationale is so that the user can see the location of the folder
> > that has just been created.
> >
> > Can you help me with this?

>
> It should be quite simple. Where before you had this:
>
> > If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
> > MsgBox "The folder '" & strNewFolder & "' already exists!"
> > Else
> > MkDir strNewFolder
> > End If

>
> .... now you'd have this:
>
> If Len(Dir(strNewFolder, vbDirectory)) > 0 Then
> MsgBox "The folder '" & strNewFolder & "' already exists!"
> Else
> MkDir strNewFolder
> Me!txtFolderPath = strNewFolder
> End If
>
> That assumes that "txtFolderPath" is the name of the text box where you
> want to display the name of the folder, and also that this code is
> running on the form that contains that text box.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      28th Jun 2007
In newsFED9F60-6640-4B3B-8891-(E-Mail Removed),
Ebitari <(E-Mail Removed)> wrote:
> Thanks for the information - it was very helpful.
>
> Now I want to launch the folder so that people can save files to it.
>
> I am using the following code:
>
> Application.FollowHyperlink "O:\EWGPP\NA-233 Task Order & Invoice
> Tracking\" & "Invoice" & " " & [Invoice Number], True
>
> This works and opens the folder, however, when I copy a file to the
> folder it does not show up until I go out of the folder and go back
> in. It does not seem to be opening the folder with the right
> settings because I can't see files immediately when I copy them to
> the opened folder. Is there a way to open a folder in a setting that
> automatically refreshes when a file is saved to it?


How are you copying the files? If you have opened the folder via
FollowHyperlink, the folder will naturally reflect the files that are in
it, and any files that are copied into it manually via the user
interface. If you're using code to copy files into the folder, I
suppose that you might need to refresh the folder, but my quick tests
with a folder on my C: drive didn't seem to have this problem. If the
folder is on a network, there my be a longer latency, though.

I have no idea how you would programmatically refresh a folder -- maybe
by locating its window via an API call and sending it a "refresh"
message of some sort. But if you'll describe what you're doing in more
detail, we may be able to come up with something.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
=[Field1] & "[","]" & [Field2] WHAT'S WRONG Garry Microsoft Access Reports 1 7th Nov 2007 11:37 AM
Setting the properties of "field1" based upon "field2" in a form =?Utf-8?B?TGF0ZXJhbA==?= Microsoft Access Form Coding 4 11th Aug 2006 05:46 AM
How to utilize "OR" for Field1 or Field2 = 1000 in Filter by Form? =?Utf-8?B?RGVubmlz?= Microsoft Access 3 21st Feb 2006 01:49 PM
Set Variable to Field2 if Field1 = "textString" =?Utf-8?B?TWFydHk=?= Microsoft Access Macros 1 7th Feb 2005 07:42 PM
FileFormat for "field1", "field2" ww Microsoft Excel Programming 1 26th Aug 2004 05:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 PM.