rio
Registered User.
- Local time
- Today, 23:04
- Joined
- Jun 3, 2008
- Messages
- 124
I have a Query name tFiles Query.
FileName FilePath FilePathName
Logplace.doc c:\Database\ c:\Database\Logplace.doc
Tanplace.doc c:\Database\ c:\Database\Tanplace.doc
I used this code to open the database.
i also used this module
when I click the button... it's open the c:\Database\Logplace.doc twice.
How to write the code to open all record just by one click????
FileName FilePath FilePathName
Logplace.doc c:\Database\ c:\Database\Logplace.doc
Tanplace.doc c:\Database\ c:\Database\Tanplace.doc
I used this code to open the database.
Code:
Private Sub Command3_Click()
Dim rs As Recordset
Dim x As Integer, i As Integer
Set rs = CurrentDb.OpenRecordset("tFiles Query")
x = rs.RecordCount
For i = 0 To x
OpenFile rs![FilePathName]
Next i
End Sub
i also used this module
Code:
Option Compare Database
Option Explicit
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Function OpenFile(sFileName As String)
On Error GoTo Err_OpenFile
OpenFile = ShellExecute(Application.hWndAccessApp, "Open", sFileName, "", "f:\", 1)
Exit_OpenFile:
Exit Function
Err_OpenFile:
MsgBox Err.Number & " - " & Err.description
Resume Exit_OpenFile
End Function
when I click the button... it's open the c:\Database\Logplace.doc twice.
How to write the code to open all record just by one click????
Last edited: