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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|