I have created a form in VBA that I want to use as a parameter form for creation of a report. Int he design of the report I have created the report with prompts. If I run the run the report, without the form, the prompts appear and the report data refreshes to give the correct data.
My problem is when I use the VBA form, I get an error saying the file is being modified by another user. The file isn't being used by anyone else but me.
On the Intialize event of the document, I have defaulted the values of the controls on the form and displayed the form. When I click the OK button on the form, to accept the parameters.
I think that it may have something to do with the report already being in memory when I try to refresh the report.
Any help with this will be greatly appreciated as I have another 10 reports to do, all basically following the same procedure.
Here is the code I am running.
On the report
Private Sub Document_Open()
Load rptRegistrarParameter
rptRegistrarParameter.Show
End Sub
On the form
Public BODataProv As BusObj.DataProvider
Public BORep As BusObj.Report
Public BO As BusObj.Application
Public blnCancel As Boolean
Public dteStartDate As Date
Public dteEndDate As Date
Public strPlace As String
Private Sub cmdOK_Click()
Set BO = CreateObject("BusinessObjects.Application"
dteStartDate = Me.DTPDateFrom
dteEndDate = Me.DTPDate2
strPlace = "aberdeen"
BO.Documents.Open ("t:\GPCT\product\pims universe\application\reports\died_in_GPCT1.rep"
BO.ActiveReport
BO.ActiveDocument.Variables("StartDate"
.Value = dteStartDate
BO.ActiveDocument.Variables("EndDate"
.Value = dteEndDate
BO.ActiveDocument.Variables("location"
.Value = strPlace
Unload Me
End Sub
Private Sub UserForm_Initialize()
Me.DTPDateFrom = Format(Now(), "dd-mm-yyyy"
Me.DTPDate2 = Format(Now(), "dd-mm-yyyy"
End Sub
My problem is when I use the VBA form, I get an error saying the file is being modified by another user. The file isn't being used by anyone else but me.
On the Intialize event of the document, I have defaulted the values of the controls on the form and displayed the form. When I click the OK button on the form, to accept the parameters.
I think that it may have something to do with the report already being in memory when I try to refresh the report.
Any help with this will be greatly appreciated as I have another 10 reports to do, all basically following the same procedure.
Here is the code I am running.
On the report
Private Sub Document_Open()
Load rptRegistrarParameter
rptRegistrarParameter.Show
End Sub
On the form
Public BODataProv As BusObj.DataProvider
Public BORep As BusObj.Report
Public BO As BusObj.Application
Public blnCancel As Boolean
Public dteStartDate As Date
Public dteEndDate As Date
Public strPlace As String
Private Sub cmdOK_Click()
Set BO = CreateObject("BusinessObjects.Application"

dteStartDate = Me.DTPDateFrom
dteEndDate = Me.DTPDate2
strPlace = "aberdeen"
BO.Documents.Open ("t:\GPCT\product\pims universe\application\reports\died_in_GPCT1.rep"

BO.ActiveReport
BO.ActiveDocument.Variables("StartDate"

BO.ActiveDocument.Variables("EndDate"

BO.ActiveDocument.Variables("location"

Unload Me
End Sub
Private Sub UserForm_Initialize()
Me.DTPDateFrom = Format(Now(), "dd-mm-yyyy"

Me.DTPDate2 = Format(Now(), "dd-mm-yyyy"

End Sub