Using MS Access/Command button to open file
Just a quick question. How do I program a command button to open a file on a networked drive? The file on the neworked drive has the same name as my record ID. So the file I am trying to open is relevant to current record on the form. I can get this to work if the file I am looking to open is on the same drive, but it does not work if the file is located on another drive. Thanks for any help you can provide me with this. It is very much appreciated as always. Carla
This is what I have so far that seems to work using one drive...
Private Sub Command169_Click()
Dim strFilename As String
strFilename = "C:\FOLDER\" & Format([PO_ID], "000000") & ".pdf"
Well you need to know where it is. Your code is correct, but you have to substitute the actual path for C:\Folder.
If different PCs have different drive mappings (letters), you can use UNC codding:
strFilename = "\\servername\sharename\foldername\" & Format([PO_ID], "000000") & ".pdf"
Hope this helps,
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA