[AccessD] Parameter Queries via Code

Admin Sparky dba.email at gmail.com
Fri Apr 29 14:04:50 CDT 2005


These each produce data type mismatch errors.
qdfMetrics.Parameters(0) = 1., 2., or 3.

1. Forms!frmDatePicker!Text14
2. "#" & Format(Forms!frmDatePicker!Text14, "m\/d\/yyyy") & "#"
3. DateValue(Forms!frmDatePicker!Text14)

In an online example that I saw, they used the following:
Dim prm As Parameter
For Each prm In qd.Parameters
prm.Value = Eval(prm.Name)
Next prm

This method hasn't worked either...same error message.

I can't remember exactly how the quote goes...something like "I must
be closer to the solution, because I've just discovered another way it
won't work".

Mark Mitsules




On 4/29/05, Gustav Brock <Gustav at cactus.dk> wrote:
> Hi Mark
> 
> Then I guess the #'s are contained in the query.
> If so:
> 
> 3.        qdfMetrics.Parameters(0) = "'" &
> Format(Forms!frmDatePicker!Text14, "m\/d\/yyyy") & "'"
> 4.        qdfMetrics.Parameters(1) = "'" &
> Format(Forms!frmDatePicker!Text16, "m\/d\/yyyy") & "'"
> 
> /gustav
> 
> >>> dba.email at gmail.com 04/29 7:58 pm >>>
> Well now...that was interesting...now I get a very specific message:
> "Data type mismatch in criteria expression."
> 
> When viewed in the Locals window the first parameter value is
> "#10/1/2004#".
> Prior to this run, it read "10/1/2004".  In both cases the Type is
> listed as Variant/String.
> 
> I'm wondering if the problem is the quotes.  For instance, another
> property for qdfMetrics is DateCreated.  The value for DateCreated
> contains no quotes it reads: #4/28/2005 12:46:53 PM#, and the Type is
> listed as Variant/Date.
> 
> I tried this:
> qdfMetrics.Parameters(0) = DateValue(Forms!frmDatePicker!Text14)
> ...but the Type was still listed as Variant/String with a value of
> "10/1/2004".
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list