John said:
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