Dixie,
Another way to look at it would be to use a mix of single and double quotes.
If you change
RunReg = Shell("regedit.exe /s """ & CurrentProject.Path &
"\SQLfix.reg""",
0)
to
RunReg = Shell("regedit.exe /s '" & CurrentProject.Path & "\SQLfix.reg'", 0)
would it make more sense to you? This would put a single quote around the
path. You have to delimit the string with quotes, but when it gets passed
VBA removes the quotes, leaving (using C:\Folder for the path)
regedit.exe /s 'C:\Folder\SQLfix.reg'
In most cases, this is acceptable, but there are some things that don't like
the single quotes. When you run across one of those, you need to find a way
to "force" the double quotes in (since Access is using them to find the
beginning and end of the string(s) you can't just put them in as normal,
there has to be a different method to distinguish between the two -
delimiter or literal quote in the string). One good example of when this is
needed is when doing a search of a Last Name field. If you place single
quotes around the field, then names such as O'Hare will cause your code to
crash because the single quote in the name causes a problem with the single
quotes around the name.
The above could also be written this way to get the double quote in instead
of using a single quote.
RunReg = Shell("regedit.exe /s " & Chr(34) & CurrentProject.Path &
"\SQLfix.reg" & Chr(34), 0)
Using the double quote is easier to type than Chr(34), but it can be harder
to read and is definitely harder to count to make sure that you have them
all matched up.
I would suggest playing with this in the Immediate Window and see what gets
returned.
Example:
?"This is a test string"
This is a test string
?"This is "" a test string"
This is " a test string
This will show you what is actually being passed once VBA removes the
delimiter quotes. The delimiter quotes tell VBA that this is a string, once
they've done that, they've done their job and aren't needed any longer. So,
they're removed. If they weren't and you assigned the value to a textbox,
the text would still have the quotes around it in the textbox instead of
just the text being there.
--
Wayne Morgan
MS Access MVP