I am using the following code to open a folder:
Dim folderstring As String
Dim rs1 As DAO.Recordset
Set rs1 = CurrentDb.OpenR ecordset("Selec t * from tblMisc_Setting s
where Description = 'Clients'", dbOpenDynaset)
folderstring = "explorer.e xe "
folderstring = folderstring & rs1!Data
folderstring = folderstring & "\"
folderstring = folderstring & Me.Client_Name
Shell folderstring, vbNormalFocus
rs1.Close
This seems to work great until the folder name has a comma in it. Some
of the folders will be a client's name in the format of Last, First
It appears to think that the "," is acting like a "\" because it gives
a message saying that a directory of the First Name of the client
doesn't exist.
Is there some way to fix this comma problem?
Thanks,
Jody 6 6114
Jody
<It appears to think that the "," is acting like a "\" because it gives
a message saying that a directory of the First Name of the client
doesn't exist.
A quirk I've just faced too - using VBA shell to create a folder
allows a comma, but navigating to that same folder by shelling to
Explorer fails.
Bummer.
The solution I've adopted is --- since the foldernames are generated
from table attributes, I do an ASCII check of the intended foldername
characters to ensure they're well-formed.
An alternative would be to test the creation and reading of the folder
in a temporary directory and proceeding from there - bit kludgy but
precise.
Can you remove the commas?
Greg
I would like to avoid removing the commas if at all possible.
Can you give me an example of the work around?
Thanks,
Jody
Is it possible to create a hyperlink object programatically and use
this to open a folder instead of the shell thing?
Jody
jodyblau wrote: I am using the following code to open a folder:
Dim folderstring As String
Dim rs1 As DAO.Recordset Set rs1 = CurrentDb.OpenR ecordset("Selec t * from tblMisc_Setting s where Description = 'Clients'", dbOpenDynaset)
folderstring = "explorer.e xe " folderstring = folderstring & rs1!Data folderstring = folderstring & "\" folderstring = folderstring & Me.Client_Name
Shell folderstring, vbNormalFocus
rs1.Close
Have you tried enclosing the name of the folder in double-quotes before
sending the whole folderstring to Shell()?
Something like this may help:
folderstring = "explorer.e xe "
folderstring = folderstring & """" & rs1.Fields("Dat a")
folderstring = folderstring & "\"
folderstring = folderstring & Me.Client_Name & """"
the same thing, but using the ASCII code for the double-quote (if that's
what you prefer):
folderstring = "explorer.e xe "
folderstring = folderstring & Chr(34) & rs1.Fields("Dat a")
folderstring = folderstring & "\"
folderstring = folderstring & Me.Client_Name & Chr(34)
That worked wonderfully!
Thanks,
Jody Blau
Beowulf <be************ *****@hotmail.c om> wrote in
news:1EkNf.1077 5$XE6.7631@trnd dc07: Have you tried enclosing the name of the folder in double-quotes before sending the whole folderstring to Shell()?
That's necessary for any directory or filename that has a space in
it. When writing Shell statements, you must enclose any file/path
argument in quotes, no matter what, in order to account for all
possibilities.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Manish Songar via .NET 247 |
last post by:
I am using asp.net. I am not storing image in sql server.I store all
the image in one folder. I want to access image from that folder to my
client machine. Images folder (\Orchid_Image) store in the same place
into the application root (server machine) like
c:\inetpub\wwwroot\OrchidDB\Orchid_Image. I am using repeter control
for show images. I already use server.Mappath but still when I run my
application in client machine it still look...
|
by: Jennifer |
last post by:
A long while back I made an ASP.Net application with VB.Net as the
code behind. It's been in MS Source Safe. I now have a new computer
and got the latest version downloaded from Source Safe on my new
computer. I'm trying open the project, which does not look to have an
..sln file associated with it. I've been trying to open the .vbproj
file. I get an error message saying: "The project you are trying to
open is a web project. You need...
|
by: kyle.crommett |
last post by:
My goal here is to get access to open a folder that is related to the
current displayed record. For example, if the customer's last name is
Smith, i want the folder "//server01/jobphotos/Smith" to pop up when
you click the Job photos button.
So far this is all I have for it...
RetVal = Shell("explorer /e,/root, //server01/jobphotos/Smith")
This works on a one time basis, but i need it to be variable so it
|
by: Jacob.Bruxer |
last post by:
Hi everyone,
I'm having trouble opening space delimited textfiles in Excel from
Visual Basic.net. I'm able to control, open and modify Excel files
from Visual Basic, so my Excel reference seems to be working ok. I
just don't know what I'm doing when I try to open a space delimited
file and want to put the data into columns. I tried recording a macro
in VBA and going from there, but then I got stuff saying "Name
'xlDelimited' is not...
|
by: Raj |
last post by:
Following is a code to open a file & print its contents on screen. But
im getting the message "file can't be opened". The thing is, that if i
create a file separately in a particular folder in C drive, only then
my file programs are working, i.e. even after providing the full path
name for the location of the file whose contents i want to read, if
the file is not present in the above specified folder, im still not
able to open the file....
| |
by: veer |
last post by:
Hi
i have a probleum in opening the access database which is on my LAN Networking with DAO. It is connecting and dispalaying the database name
but when i use to open it, error displayed named" Couldn't find the file"
I have read and write permissions for the database
tree of folder is
e,g. Main Folder -> 46 folders -> each folder has mdb database-> each database has two tables
my programe executes succefully upto third step i,e mdb...
|
by: kimiraikkonen |
last post by:
Hi,
I have an app which has a listbox and when i double click an
associated fileS, i want their paths to be added into listbox in my
application.
This code works good when i try to open a "single" file with my app
which works to get commandline arguments to get file paths:
Dim cla As String() = Environment.GetCommandLineArgs()
If cla.Length 1 Then
|
by: alivip |
last post by:
Is python provide search in parent folder contain sub folders and files
for example folder name is cars and sub file is Toyota,Honda and BMW and Toyota contain file name camry and file name corola, file name honda contain folder accord and BMW contain file name X5
Is there way to enter name of parent folder(cars) and search in all sub folder(Toyota,Honda and BMW) and files ?
how can I intgreat cod to be user interface (buttun ,text box...
|
by: alivip |
last post by:
how to ingrate my code to read text in in parent folder contain sub folders and files for example folder name is cars and sub file is Toyota,Honda and BMW and Toyota contain file name Camry and file name corolla, file name Honda contain folder accord and BMW contain file name X5
Is there way to enter name of parent folder(cars) and search in all sub folder(Toyota,Honda and BMW) and files ?
please help ASAP
code is find most frequent...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |