Parameter Data Type Problem




A2000, DAO 3.6 ref set, 2 Parameters in query from an unbound form.

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qryDef As DAO.QueryDef
Dim prm As DAO.Parameter

Set db = CurrentDb
Set qryDef = db.QueryDefs("qryWeeklyCreditClass")

For Each prm In qryDef.Parameters
prm = Eval(prm.Name)
Next

Set rst = qryDef.OpenRecordset <========== Breaks here (3464,
Data Type mismatch)

I have two *possible* reasons:
1. Query references several sub queries, each of which also reference
the form parameters
2. Parameters are dates. I've tried concatonating "#"s, and using
cdate() but no joy

Needless to say, the query runs fine normally.

Anyone know why this is happening or how to get around it? Starting to
lose the plot on this one!!!

.



Relevant Pages

  • Re: ADODB Recordset Not Loading From Parameter Query
    ... The query itself runs fine when running manually and supplying the ... Dim con As ADODB.Connection ... Dim prm As ADODB.Parameter ... Set prm = cmd.CreateParameter("@LastName", adVarChar, adParamInput, 25) ...
    (microsoft.public.access.modulesdaovba)
  • Re: OpenRecordset
    ... query is taking values or criteria from fields on a form (which are treated ... Dim qdf As DAO.QueryDef ... Dim prm As DAO.Parameter ...
    (microsoft.public.access.formscoding)
  • Re: QueryDef
    ... enough to evaluate when the query is opened from the database window. ... Dim db1 As Database ... Dim prm As Parameter ...
    (microsoft.public.access.formscoding)
  • Re: Loading query into a recordset...
    ... Set MyRecordSet = qdf.OpenRecordset ... For Each prm in qdf.Parameters ... > You don't need to use the name of the query in the OpenRecordset action. ... >> Dim MyRecordSet As DAO.Recordset>> Dim qdf As QueryDef ...
    (microsoft.public.access.modulesdaovba)
  • RE: Field selected by Combo Box
    ... Public Sub OpenTempQuery(strSQL As String) ... Dim dbs As DAO.Database ... Dim prm As DAO.Parameter ... button a query would run that would show the grouped field entries for their ...
    (microsoft.public.access.queries)