Passing values to MsAcess Reports

  • Thread starter Thread starter shou
  • Start date Start date
S

shou

Guest
Hello Fellas,

I am facing a problem with passing a value from my asp page to MsAccess report, as i have to show the report on web .

I think it is very simple but i am not able to figure it out as where i am going wrong. Any help on this will be gr8.

I am explaining:

I have a Msaccess DB, with lots of tables, queries and reports saved.
On the report i am using DLookUp to show the customer name.
=DLookUp("[Slogan]","Kantoor","strWhere")

from my Asp page i am opeining the db , then opening the report and passing the query.But is not working.
//////////////////////////////////////////////////
my asp code is
Set objAccess = Server.CreateObject("Access.Application")
objAccess.Visible = False
Dim tes
tes="17"
strWhere="[ID Kantoorgegevens]='" & tes & "'"

'-----------------------------------------------------------------
' Open the database, then the Report, and output it in Snapshot format
'-----------------------------------------------------------------
objAccess.OpenCurrentDatabase strDbName

With objAccess.DoCmd
' open in preview mode so that we can pass a where clause
' if neccesary
.OpenReport strRptName, acViewPreview, strFilter, strWhere
' now you can save the report to snapshot format
' Server.MapPath gets the current directory.
.OutputTo acOutputReport, , "Snapshot Format", Server.MapPath(".") & _
"\snapfiles\" & strSnapFile
.Close
End With

' Clean Up
objAccess.Quit acQuitSaveNone 'acQuitSaveNone
Set objAccess = Nothing
///////////////////////////////////////////////////////

however if i hard code the strwhere value in DLookUp code in msAccess report,then it is wokring fine.

can any one help me where i am wrong

regards,
 
Join another query in your report recordsource to lookup the desired value as oppsed to using a DLookup. DLookup's are very very slow.
 

Users who are viewing this thread

Back
Top Bottom