Hyperlink Field Type Won't Allow Command Switches

C

Clint Marshall

I'm trying to use a hyperlink field in one Access XP database as a link to
open a specific record in a specific form in another Access XP database.

The following text works fine as a command line from the "Run" command:
"C:\Program Files\Microsoft Office\Office10\MSAccess.exe"
"S:\FORERIVR\clint forerivr.mdb" /cmd frmTenant,[Tenant]=149

When I paste it into an Access hyperlink field, Access drops everything
except "C:\Program Files\Microsoft Office\Office10\MSAccess.exe". this, of
course, doesn't get me there.

Is there any way to enter this sort of data into an Access hyperlink field
so that I can click on the hyperlink and open the desired database, form, and
record?
If it can't be done in a hypelink field, is there any sort of workaround?

Thank you!

-Clint Marshall
 
C

Clint Marshall

Thank you Doug.

I'm embarrassed to say, however, that I don't know how to apply this
infromation.
Can I enter this into an Access hyperlink field? What would it look
like/what would I actually type?

Thanks again!

Douglas J. Steele said:
You should be able to call that entire string using the Shell statement.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)

"C:\Program Files\Microsoft Office\Office10\MSAccess.exe"
"S:\FORERIVR\clint forerivr.mdb" /cmd frmTenant,[Tenant]=149
 
D

Douglas J. Steele

No, you can't enter it into a hyperlink field. You'll have to put logic in
the Click event of the text box:

Private Sub MyTextbox_Click()
Dim strCommand As String

strCommand = """C:\Program Files\Microsoft Office\Office10\MSAccess.exe""
" & _
"""S:\FORERIVR\clint forerivr.mdb"" /cmd frmTenant,[Tenant]=149"

Shell strCommand, vbNormalFocus

End Sub

Note all of the double quotes when setting strCommand. Because there are
spaces in both the path to msaccess.exe and the name of your mdb file, it's
necessary to ensure that they're enclosed in quotes. For more of an
explanation of why there are so many quotes. see what Allen Browne has at
http://www.allenbrowne.com/casu-17.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Clint Marshall said:
Thank you Doug.

I'm embarrassed to say, however, that I don't know how to apply this
infromation.
Can I enter this into an Access hyperlink field? What would it look
like/what would I actually type?

Thanks again!

Douglas J. Steele said:
You should be able to call that entire string using the Shell statement.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)

"C:\Program Files\Microsoft Office\Office10\MSAccess.exe"
"S:\FORERIVR\clint forerivr.mdb" /cmd frmTenant,[Tenant]=149
 

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