J
Jeffrey_Chcgo
I am working from an Access 97 split database. I am attempting to print a
report. The datasource for the report is a recordset created from a filter.
The filter is created from data that is currently in the user form:
lngClaimNumber = Forms.frmMainForm.tbxClaim_Number
strCriteria = "SELECT * FROM tblCustomers"
strCriteria = strCriteria & " WHERE Claim_Number = "
strCriteria = strCriteria & lngClaimNumber
Set rsCurrentRecordSource = dbInput.OpenRecordset(strCriteria)
rsCurrentRecordSource.MoveLast
rsCurrentRecordSource.MoveFirst
Do Until rsCurrentRecordSource.EOF
'start printing here
Echo (0)
DoCmd.OpenReport "rptFolderReport", acDesign
Reports("rptFolderReport")!lblClaim_Number.Caption =
rsCurrentRecordSource!Claim_Number
DoCmd.Close acReport, "rptFolderReport", acSaveYes
DoCmd.OpenReport "rptFolderReport", acNormal
Echo (1)
rsCurrentRecordSource.MoveNext
Loop
rsCurrentRecordSource.Close
Set rsCurrentRecordSource = Nothing
dbInput.Close
Set dbInput = Nothing
This works when printing from a non-run-time front-end. However when
printing from run-time front-ends each successive print job prints using the
same filter criteria from the previous print job. In other words, the
recordset does not get refreshed when the Claim Number in the form
frmMainForm changes.
report. The datasource for the report is a recordset created from a filter.
The filter is created from data that is currently in the user form:
lngClaimNumber = Forms.frmMainForm.tbxClaim_Number
strCriteria = "SELECT * FROM tblCustomers"
strCriteria = strCriteria & " WHERE Claim_Number = "
strCriteria = strCriteria & lngClaimNumber
Set rsCurrentRecordSource = dbInput.OpenRecordset(strCriteria)
rsCurrentRecordSource.MoveLast
rsCurrentRecordSource.MoveFirst
Do Until rsCurrentRecordSource.EOF
'start printing here
Echo (0)
DoCmd.OpenReport "rptFolderReport", acDesign
Reports("rptFolderReport")!lblClaim_Number.Caption =
rsCurrentRecordSource!Claim_Number
DoCmd.Close acReport, "rptFolderReport", acSaveYes
DoCmd.OpenReport "rptFolderReport", acNormal
Echo (1)
rsCurrentRecordSource.MoveNext
Loop
rsCurrentRecordSource.Close
Set rsCurrentRecordSource = Nothing
dbInput.Close
Set dbInput = Nothing
This works when printing from a non-run-time front-end. However when
printing from run-time front-ends each successive print job prints using the
same filter criteria from the previous print job. In other words, the
recordset does not get refreshed when the Claim Number in the form
frmMainForm changes.