G
Guest
I have seen posts about resolving parameters, but I must not be doing it right.
The following code is exerpted from the sub cmdContinue_Click in the class
module Form_fdlgProcessingSelector:
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Set qdf = CurrentDb.QueryDefs!qryInquiry_new
With qdf
.Parameters!prm_dtmProcess = gdtmProcess
.Parameters!prm_dtmLastRun = gdtmLastRun
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
End With
DoCmd.OpenForm "frmInquiryNotBalanced"
gdtmProcess and gdtmLastRun are public variables declared in the sub
Form_Open in the same class module.
The SQL statement for qryInquiry_new is:
PARAMETERS prm_dtmProcess DateTime, prm_dtmLastRun DateTime;
SELECT tblProspect_import.pkID, tblProspect_import.strPOISE_Representative
AS fk_strPOISE_Representative, tblAdmissionCode.ysnHighSchool,
IIf(IsDate([strInquiryDate]),CDate([strInquiryDate]),0) AS dtmInquiry
FROM tblAdmissionCode INNER JOIN tblProspect_import ON
tblAdmissionCode.pk_strAdmissionCode=tblProspect_import.fk_strMigrationStatus
WHERE (((IIf(IsDate([strInquiryDate]),CDate([strInquiryDate]),0)) Between
prm_dtmProcess-1 And prm_dtmLastRun));
The code stops on the looped statement with the error "Microsoft Office
Access can't find the name 'prm_dtmProcess' you entered in the expression"; I
chose debug. I mouse-over "prm.name" and the tip responds
"prm.name='prm_dtmProcess'"; I mouse-over "prm.value" and the tip responds
"prm.value=7/11/2006".
Where have I gone wrong?
The following code is exerpted from the sub cmdContinue_Click in the class
module Form_fdlgProcessingSelector:
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Set qdf = CurrentDb.QueryDefs!qryInquiry_new
With qdf
.Parameters!prm_dtmProcess = gdtmProcess
.Parameters!prm_dtmLastRun = gdtmLastRun
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
End With
DoCmd.OpenForm "frmInquiryNotBalanced"
gdtmProcess and gdtmLastRun are public variables declared in the sub
Form_Open in the same class module.
The SQL statement for qryInquiry_new is:
PARAMETERS prm_dtmProcess DateTime, prm_dtmLastRun DateTime;
SELECT tblProspect_import.pkID, tblProspect_import.strPOISE_Representative
AS fk_strPOISE_Representative, tblAdmissionCode.ysnHighSchool,
IIf(IsDate([strInquiryDate]),CDate([strInquiryDate]),0) AS dtmInquiry
FROM tblAdmissionCode INNER JOIN tblProspect_import ON
tblAdmissionCode.pk_strAdmissionCode=tblProspect_import.fk_strMigrationStatus
WHERE (((IIf(IsDate([strInquiryDate]),CDate([strInquiryDate]),0)) Between
prm_dtmProcess-1 And prm_dtmLastRun));
The code stops on the looped statement with the error "Microsoft Office
Access can't find the name 'prm_dtmProcess' you entered in the expression"; I
chose debug. I mouse-over "prm.name" and the tip responds
"prm.name='prm_dtmProcess'"; I mouse-over "prm.value" and the tip responds
"prm.value=7/11/2006".
Where have I gone wrong?