Open Numbered Folder

  • Thread starter babyatx13 via AccessMonster.com
  • Start date
B

babyatx13 via AccessMonster.com

I have a form where I can open the folder based on project number, however,
when I try to open the folder # 4 for project # 4 it opens folder # 44
instead. Does anyone have a good fix for this?

Thanks
K Board
 
J

Jeff Boyce

"How" depends on "what" ... and we don't know what data you're working with!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

babyatx13 via AccessMonster.com

Project no. is a number field. I am just trying to open a folder for project
no 4 that has other folders in it. The folder I am trying to open is named 4
the folder it is opening is named 44.
 
K

KARL DEWEY

Are you sure you are working with Access, the relational database that is
part of Microsoft Office Professional as it has no 'folders'?
 
B

babyatx13 via AccessMonster.com

YES …… I created these folders using Access now I want to open them using
Access. This is obviously a number issue; it is finding the first occurrence
of the number and opening it. I just want to know how to fix the problem.

KARL said:
Are you sure you are working with Access, the relational database that is
part of Microsoft Office Professional as it has no 'folders'?
Project no. is a number field. I am just trying to open a folder for project
no 4 that has other folders in it. The folder I am trying to open is named 4
[quoted text clipped - 13 lines]
 
J

Jeff Boyce

Repeating the same problem doesn't help us understand what you're looking
at.

"How" depends on "what"...

For example, where are you storing [FolderNumber]? In that table (you're
storing in a table, right?), what is the definition of that field's data
type?

When you say "I created these folders using Access", what do you mean? What
process, function, code, macro, ... did you use to "create these folders"?
I'm with Karl ... I'm not familiar with using Access to create folders.

More info, please!

Regards

Jeff Boyce
Microsoft Office/Access MVP

babyatx13 via AccessMonster.com said:
YES .. I created these folders using Access now I want to open them using
Access. This is obviously a number issue; it is finding the first
occurrence
of the number and opening it. I just want to know how to fix the problem.

KARL said:
Are you sure you are working with Access, the relational database that is
part of Microsoft Office Professional as it has no 'folders'?
Project no. is a number field. I am just trying to open a folder for
project
no 4 that has other folders in it. The folder I am trying to open is
named 4
[quoted text clipped - 13 lines]
Thanks
K Board
 
B

babyatx13 via AccessMonster.com

Jeff Boyce:
For example, where are you storing [FolderNumber]? In that table (you're
storing in a table, right?), what is the definition of that field's data
type?
I told you it is a number field.
When you say "I created these folders using Access", what do you mean? What
process, function, code, macro, ... did you use to "create these folders"?

I don't see why that matters.
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.

sorry to have bothered you with my problem.
K Board
 
J

Jeff Boyce

You'll find folks here in the newsgroups very willing to help... but until
we understand why and how, any suggestions we can offer will be fairly
generic.

You're there, we're not. You need to give us enough info to help you.

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.

If you don't feel you're getting the kind of help you need, feel free to
post back with another thread. Perhaps if you present your situation at bit
differently, one of the folks who frequent this newsgroup will be able to
help.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP


babyatx13 via AccessMonster.com said:
Jeff Boyce:
For example, where are you storing [FolderNumber]? In that table (you're
storing in a table, right?), what is the definition of that field's data
type?
I told you it is a number field.
When you say "I created these folders using Access", what do you mean?
What
process, function, code, macro, ... did you use to "create these folders"?

I don't see why that matters.
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.

sorry to have bothered you with my problem.
K Board
 
J

John W. Vinson

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.
 
B

babyatx13 via AccessMonster.com

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.
 
B

babyatx13 via AccessMonster.com

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
 
B

babyatx13 via AccessMonster.com

Never mind I figured it out
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.
 
B

babyatx13 via AccessMonster.com

babyatx13 said:
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.
 
J

Jeff Boyce

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
 

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