Getreport.asp question trying to call an ID with s

Results 1 to 2 of 2

Thread: Getreport.asp question trying to call an ID with s

  1. #1
    Join Date
    Dec 1969

    Default Getreport.asp question trying to call an ID with s

    Hi,I am using the getreport form the 4rolla and found the code was great, but it does not give me a few awswers I am looking for. I am trying to push a selected id from a text box back to the query that runsd the report. When I run the ASP I get the report format with out data. Here is the code below.<BR><BR>Sub Get_Report<BR><BR>Dim strNum, systime &#039;these vars are used to get the unique file name<BR>DIM strDbName, strRptName, strWhere, strSnapFile, strFilter<BR><BR>Dim objAccess <BR> strNum = "Report"<BR> systime=now()<BR> strNum= strNum & cstr(year(systime)) & cstr(month(systime)) & cstr(day(systime))<BR> strNum= strNum & cstr(hour(systime)) & cstr(minute(systime)) & cstr(second(systime))<BR> strSnapFile = strNum & ".snp"<BR><BR>strDbName = "h:
    mw3.mdb"<BR>strRptName = Request.Form("report")<BR><BR>I have tried several different calls for the strWhere and nothing seems to work<BR><BR>strWhere = ""<BR>strFilter = ""<BR><BR>Set objAccess = Server.CreateObject("Access.Application")<BR>objAc cess.Visible = False<BR><BR>objAccess.OpenCurrentDatabase strDbName<BR><BR>With objAccess.DoCmd<BR> .OpenReport strRptName, acViewPreview, strFilter, strWhere<BR> .OutputTo acOutputReport, , "Snapshot Format", Server.MapPath(".") & _<BR> "snapfiles\" & strSnapFile<BR> .Close<BR>End With<BR><BR>objAccess.Quit acQuitSaveNone &#039;acQuitSaveNone<BR>Set objAccess = Nothing<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Getreport.asp question trying to call an ID wi

    I have frequently had that problem with the Access report printing or previewing without data. You may not like the workaround solution I came up with, but what I did was put a 3-8 second delay between the time I called OpenCurrentDatabase and DoCmd.OpenReport<BR><BR>objAccess.OpenCurrentDatab ase strDbName<BR>tTime = DateAdd("s",3,Time)<BR>Do Until Time &#062; tTime<BR>Loop<BR><BR>With objAccess.DoCmd<BR>.OpenReport strRptName, acViewPreview, strFilter, strWhere<BR><BR>All I can figure is that sometimes you just have to let Access catch up with the real world.<BR><BR>As for the strWhere argument, it is simply a WHERE clause without the word WHERE<BR>"FirstName = &#039;John&#039;"<BR>"BuildingID = 1"<BR><BR>I never use the Filter argument, but what I do is just insert a comma to indicate I am skipping the argument.<BR><BR>.OpenReport strRptName, acViewPreview, , strWhere<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts