A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open Numbered Folder



 
 
Thread Tools Display Modes
  #11  
Old July 7th, 2009, 07:08 PM posted to microsoft.public.access.forms
babyatx13 via AccessMonster.com
external usenet poster
 
Posts: 43
Default Open Numbered Folder

John W. Vinson wrote:

The names of Folders (subdirectories to use another name) in Windows are text
strings... the text string might consist of just digits, but the name of the
folder is STILL a text string, not a number.

thank you John Finally someone who knows something. I tried to use a string
value to look it up but I am getting the same result.
As Jeff says, we need some clarification of your question.

Ok well then here it goes. This is the method I am creating the folders.

xprono = rst2.Fields("ProjectNo")
fol = P:\ & xprono
CreateFolders
~~~~~~~~~~~~~~~~~~~~~~~~~
Function CreateFolders()
Dim rst As ADODB.Recordset
Dim currconn As ADODB.Connection
Dim tmp As String
Set rst = New ADODB.Recordset
Set currconn = CurrentProject.Connection

CreateFolder

rst.Open "Select * from tfolders", currconn, adOpenStatic, adLockOptimistic
‘Note: tfolders is a table that has a list of folders in it that need to go
into each project folder.
While Not rst.EOF
tmp = P:\
If IsNull(rst("fname")) Or rst("fname") = "" Then
MsgBox "You have a blank in your folders list!" & Chr(13) _
& "Please correct this through Folder Maintenance."
rst.MoveNext
Else
fol = tmp & xprono & "\" & rst("fname") & "\"
CreateFolder
rst.MoveNext
End If
Wend
End Function
~~~~~~~~~~~~~~~~~
Function CreateFolder()
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(fol) Then
fso.CreateFolder (fol)
Else
MsgBox fol & " already exists!", vbExclamation, "Folder Exists"
End If
End Function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the cod I’m using to open the folders.

Private Sub OpenFolder_Click()
Dim xtemp
Dim xPath
Dim xFolder
Dim tname
xPath = P:\
xFolder = Me![projectno_cbo]
xtemp = FolderExists(xPath & xFolder & "*")
If xtemp = True Then
tname = Dir(xPath & xFolder & "*", vbDirectory)
End If
Me.OpenFolder.HyperlinkAddress = xPath & tname
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also tried

Dim strFolderName As String
strFolderName = Me![projectno_cbo]
xFolder = strFolderName

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200907/1

  #12  
Old July 7th, 2009, 08:00 PM posted to microsoft.public.access.forms
babyatx13 via AccessMonster.com
external usenet poster
 
Posts: 43
Default Open Numbered Folder

Never mind I figured it out

John W. Vinson wrote:
but I am using VBA code to create a folder with the same NUMBER as the
Project number, which is a NUMBER field. when I get back to the office i
will
try looking the folder number up using a string value and see if that
works.


The names of Folders (subdirectories to use another name) in Windows are text
strings... the text string might consist of just digits, but the name of the
folder is STILL a text string, not a number.

As Jeff says, we need some clarification of your question.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200907/1

  #13  
Old July 7th, 2009, 08:05 PM posted to microsoft.public.access.forms
babyatx13 via AccessMonster.com
external usenet poster
 
Posts: 43
Default Open Numbered Folder

babyatx13 wrote:
Never mind I figured it out

tname = Dir(xPath & xFolder & "*", vbDirectory)
I took out the &"*" and it works fine.
&"*" was in there because the previous customer would rename the folders
with not only the number but a name as well.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200907/1

  #14  
Old July 8th, 2009, 04:36 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Open Numbered Folder

Thanks for the additional clarification. It's a bit tough for folks here to
offer specific suggestions without specific descriptions...

Congratulations on solving your issue, and thanks for posting how you did
so -- someone else may run into a similar issue in the future and be able to
use your approach.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"babyatx13 via AccessMonster.com" u7025@uwe wrote in message
news:98ba3db5941bc@uwe...
Jeff Boyce
By the way, "number" fields in Access are for doing math. If you aren't
adding/subtracting/multiplying/dividing your "Folder Number"s, they aren't
"numbers", they're text.

Sigh.............I did not create this database....the Project numbers
started out number fields for auto number reasons, they are referenced in
other tables as numbers therefore I have not changed the project number to
any other format, therefore the project number IS a NUMBER filed.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200907/1



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.