Data ?Type conversion Error

JesseH

Registered User.
Local time
Yesterday, 23:41
Joined
Apr 24, 2009
Messages
44
I am trying to execute a query that has a parameter. I have defined the parameter as "double" in the query(PARAMETERS SelectedInv IEEEDouble;).
This is my VBA Code
Dim qdfParm As QueryDef
Dim ParmInv As Double
ParmInv = Me!txtInv
Set qdfParm = dbs.QueryDefs("qryRemoveAllInvoicesExceptSelected")
qdfParm.Parameters(0) = CDbl(ParmInv)
qdfParm.Execute "qryRemoveAllInvoicesExceptSelected"

I have tried everything I can think of to get rid of the "run-time Error '3421':Data Type Conversion Error". I have Tried defining qdfParm.parameters(0) as ParmInv (without the function), I have tried Variant, etc.
Any suggestions?
Thanks
 
Are you sure you aren't having issues with NULLS or Empty Strings?
 
I am sure. I have "debugged" and seen that the passed parm have a value. I have changed the query to select nulls only (is null) and I get nothing back.
 
then you likely don't have any nulls, which if the field was defined as text in the table I could understand that. It could be empty strings which look like nulls. But if it is a number field then it is either null or has a value. So a bit of a mystery. If the data is not proprietary in nature, perhaps you could post your database with any sensitive data removed and bogus data substituted so we can play with it to see what is actually going on.
 
Thanks for all your help. I gave up and decided to "just get the job done"
This is what I did
dbs.Execute "Delete * from tblInvoices where trim(Invno) <> '" & Trim(Str(Me!txtInv)) & "'"

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom