I use this code to open a txt file in access:
I will be giving some co-workers access to this db and not everyone has NT so the path of Notepad will be different.VB Code:
Private Sub cmdViewFile_Click() Dim retval As Variant Dim strpath As String strpath = "c:\logfile.txt" retval = Shell("C:\winnt\system32\notepad.exe" & " """ & strpath & """", vbNormalFocus) End Sub
What I have done is created a field for FilePath that holds the path of the associated file. I would like to code the button to use that field as the full path and when clicked use the systems default viewer to open it.
I use this in my vb app;
But I am new to VBA!VB Code:
ShellExecute Me.hwnd, vbNullString, File1.path & "\" & sName, vbNullString, "c:\", SW_SHOWNORMAL
P.S. I have searched this forum and the access forums I use but something similar to what I already have is all I've gotten.
I hope I was clear and I hope someone can help!?!
JO




Reply With Quote