williey
Technical User
- Jan 21, 2004
- 242
I converted a report from using 3 views to 3 stored procedures. The report has 3 parameters setup, date range, string1, string2. Both string1 and string2 has default values set.
Now I'm getting the below error message
The instruction at "0x77fcc8e1" referenced memory at "0x00000000". The memory could not be written".
------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
Now I'm getting the below error message
The instruction at "0x77fcc8e1" referenced memory at "0x00000000". The memory could not be written".
Code:
CONST FIRST_DAY_OF_MONTH = "01"
' Declare variables
Dim rptcnt
Dim oRptApp, oRpt, oRpt1Param1
Dim strDate : strDate = Right(CStr(Year(Now)), 2) & Right("0" & CStr(Month(Now)), 2) & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2)
Dim startDate : startDate = Right("0" & CStr(Month(Now)), 2) & "/" & FIRST_DAY_OF_MONTH & "/" & CStr(Year(Now))
Dim endDate : endDate = Right("0" & CStr(Month(Now)), 2) & "/" & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2) & "/" & CStr(Year(Now))
' Check for Monthend
if Day(Now) = "1" then
strDate = Right("0" & CStr(Year(DateAdd("y", -1, Now))), 2) & Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2)
startDate = Cstr( Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & "/" & FIRST_DAY_OF_MONTH & "/" & Year(DateAdd("y", -1, Now)) )
endDate = Cstr( Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & "/" & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2) & "/" & Year(DateAdd("y", -1, Now)) )
end if
' Check for Yearend
if Day(Now) = "1" and Month(Now) = "1" then
strDate = Right("0" & CStr(Year(DateAdd("yyyy", -1, Now))), 2) & Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2)
startDate = Cstr( Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & "/" & FIRST_DAY_OF_MONTH & "/" & Year(DateAdd("y", -1, Now)) )
endDate = Cstr( Right("0" & CStr(Month(DateAdd("m", -1, Now))), 2) & "/" & Right("0" & CStr(Day(DateAdd("d", -1, Now))), 2) & "/" & Year(DateAdd("y", -1, Now)) )
end if
' Set the object for the App
Set oRptApp = CreateObject("CrystalRuntime.Application")
Set oRpt = oRptApp.OpenReport(INPUT_PATH & IN_FILE(rptcnt), 1)
' Set the first parameter
Set oRpt1Param1 = oRpt.ParameterFields.Item(1)
' Clear the first parameter value
oRpt1Param1.ClearCurrentValueAndRange
' oRpt1Param2.ClearCurrentValueAndRange
' oRpt1Param3.ClearCurrentValueAndRange
msgbox(IN_FILE(rptcnt))
' Set the value of the first param
oRpt1Param1.AddCurrentRange CDate(startDate), CDate(endDate), CDbl("3")
oRpt.ReadRecords
' Write to file to disk
oRpt.SaveAs OUTPUT_PATH & OUT_FILE(rptcnt) & "_" & "D" & strDate & FILE_EXT , 2048
------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.