(this is way easier in VB.Net -- but here is how to do it from Access)
'------------------------------------------------
Public Declare Function apiShellExecute 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
'***App Window Constants***
Public Const WIN_NORMAL = 1 'Open Normal
Public Const WIN_MAX = 3 'Open Maximized
Public Const WIN_MIN = 2 'Open Minimized
'***Error Codes***
Private Const ERROR_SUCCESS = 32&
Private Const ERROR_NO_ASSOC = 31&
Private Const ERROR_OUT_OF_MEM = 0&
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&
Sub RunReport()
Dim url As String, lRet As Long
url =
"http://yourServer/ReportServer?/rptDir/reportName&rs:Format=excel&Recor
dID=10007&UserID=steve"
lRet = apiShellExecute(hWndAccessApp, vbNullString, _
url, vbNullString, vbNullString, WIN_NORMAL)
End Sub
after ...rs:Format=excel... I have 2 parameters that I pass to my report
-- a recordID and a UserName. That is how you pass the parameters to
sql server reporting services from Access. It is actually the same in
VB.Net except you don't have to deal with the API function. I just use
a .Net web browser control in place of the API.
Rich
*** Sent via Developersdex http://www.developersdex.com ***