Hello all!
I have a sub in my db that worked in WinXP/Access 2003, but now that we are upgrading our machines to Win7/Access 2010 it gives me an error. Here is the offending code:
Code:
sFilePath = "C:\FolderPath\"
sfile = sFilePath + Forms.formname.Combo1 + "*.PDF"
DoEvents
Shell "C:\pdfprinter.exe -print """ & sfile & """"
Basically, it sends a shell command to a program that silently prints any pdfs in the location given that have a file name matching "Combo1Value*.PDF". So if Combo1's value is A, it will print AA.pdf, AB.pdf, and AC.pdf. This works perfectly in 2003, but in 2010 I get an error 5 (invalid argument). Removing the asterisk gets rid of the error, but also removes the intended use of the sub. I tried putting brackets around it like you would to pass it through a query, but that does not work. What do I have to do to get 2010 to pass the asterisk through to the shell? I've searched extensively on this subject and only seem to come up with ways to use an asterisk as criteria in a query, none of which work if I try them here.
Note: I have no control over the file names and what comes after the "Combo1Value" in the file name changes without notice. So I for sure need a solution that preserves the wildcard.
TIA
CD