D
DawnTreader
Hello
i have a project where i am trying to open a folder to which my app will
only know the first five characters of.
here is my code for the function:
Public Function fsFoldersearch(strProdType As String, strFolderSerial As
String)
Dim strFolder As String
Let strFolder = "C:\WO\" & strProdType & "\1 Completed\" &
strFolderSerial & "*"
Shell """C:\WINDOWS\EXPLORER.EXE""" & " " & Chr(34) & strFolder &
Chr(34), vbNormalFocus
End Function
i thought maybe a wildcard would work, but alas... it does not.
unfortunately that means i need to search for the folder and when i find it
put that in as the full folder name in place of the strFolderSerial variable
i have in the code.
can someone please help me with searching for the folder name based on the
known first 5 characters.
i also posted this problem elsewhere with a more full description, check
this out:
"i have need of a little help. i have looked at a few resources on the
internet regarding making lists of files and folders and either returning
them to a table or listbox, as well as doing other things with the returned
data. i even had a coworker jog my brain as to how i would open explorer to
where i want it. thats all great.
my problem is that i am unsure where to beging or what functions to use to
do what i would like to create.
here is the scenario. i have a table with products, each product has a
serial number which correspond to part of the name a folder on a drive where
all sorts of information is stored. i was using hyperlinks to make the
folders open on a click. the problem is that people are constantly changing
the name or placement of these folders. i know they shouldnt be, but i dont
care about that anymore. i know there is a way to do what i want. i just dont
know how.
i want to use the serial number to find the corresponding folder and then
open that folder with windows explorer.
here is what i know has to happen. the command button that i create has to
call a routine to take the field where the serial number is stored, it will
have to be trimmed to 5 character from the left, i know how to do that and
then compare that to a search through all the folders starting at the
specified folder (C:\WO\) and look at the first 5 characters of the folder
name. then it should store the folder name and use that as an argument to
open an explorer window.
what function would best serve this purpose? can anyone suggest some code to
get this started? has someone already done this before?"
and
"i dont want to store paths in a table. my db is bloated enough as it is.
all i need is to get the first 5 characters of a folder name into a variable
and compare that with the first 5 characters of a field on my form. if the 2
match then i want to grab the whole folder name and cause it to open an
explorer window. putting all the paths in a table is unnecessary. can we not
just loop until the variable with the first 5 folder name characters match
the 5 field characters?
another thing i see in this code is that it is written to find files. i dont
want a file. i want folders. is there a function that will call the name of
just the folder and allow me to store it in a string variable so i can
compare it to a field?"
the function works upto the subfolder name that i only have the first 5
characters of. without knowing how to find the full folder name and return
that to put in the shell command i am dead in the water.
i have a project where i am trying to open a folder to which my app will
only know the first five characters of.
here is my code for the function:
Public Function fsFoldersearch(strProdType As String, strFolderSerial As
String)
Dim strFolder As String
Let strFolder = "C:\WO\" & strProdType & "\1 Completed\" &
strFolderSerial & "*"
Shell """C:\WINDOWS\EXPLORER.EXE""" & " " & Chr(34) & strFolder &
Chr(34), vbNormalFocus
End Function
i thought maybe a wildcard would work, but alas... it does not.
unfortunately that means i need to search for the folder and when i find it
put that in as the full folder name in place of the strFolderSerial variable
i have in the code.
can someone please help me with searching for the folder name based on the
known first 5 characters.
i also posted this problem elsewhere with a more full description, check
this out:
"i have need of a little help. i have looked at a few resources on the
internet regarding making lists of files and folders and either returning
them to a table or listbox, as well as doing other things with the returned
data. i even had a coworker jog my brain as to how i would open explorer to
where i want it. thats all great.
my problem is that i am unsure where to beging or what functions to use to
do what i would like to create.
here is the scenario. i have a table with products, each product has a
serial number which correspond to part of the name a folder on a drive where
all sorts of information is stored. i was using hyperlinks to make the
folders open on a click. the problem is that people are constantly changing
the name or placement of these folders. i know they shouldnt be, but i dont
care about that anymore. i know there is a way to do what i want. i just dont
know how.
i want to use the serial number to find the corresponding folder and then
open that folder with windows explorer.
here is what i know has to happen. the command button that i create has to
call a routine to take the field where the serial number is stored, it will
have to be trimmed to 5 character from the left, i know how to do that and
then compare that to a search through all the folders starting at the
specified folder (C:\WO\) and look at the first 5 characters of the folder
name. then it should store the folder name and use that as an argument to
open an explorer window.
what function would best serve this purpose? can anyone suggest some code to
get this started? has someone already done this before?"
and
"i dont want to store paths in a table. my db is bloated enough as it is.
all i need is to get the first 5 characters of a folder name into a variable
and compare that with the first 5 characters of a field on my form. if the 2
match then i want to grab the whole folder name and cause it to open an
explorer window. putting all the paths in a table is unnecessary. can we not
just loop until the variable with the first 5 folder name characters match
the 5 field characters?
another thing i see in this code is that it is written to find files. i dont
want a file. i want folders. is there a function that will call the name of
just the folder and allow me to store it in a string variable so i can
compare it to a field?"
the function works upto the subfolder name that i only have the first 5
characters of. without knowing how to find the full folder name and return
that to put in the shell command i am dead in the water.