Vbaruntime error 1004 generel odbc-failure

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 10:01 PM GMT

QuestionEdit

Hello I have a macro who works properly when I use this line in my query from excel:

, "vReklamation_0.Dato Between {d '2010-04-01'} And {d '2010-04-30'}))")

When I instead use this line, it do not work, and I get an runtime error 1004, general ODBC-failure:

, "vReklamation_0.Dato Between #" & start2 &"# AND #" & slut2 &"# ))")

When I use this line, I have written so in the first lines: Dim start As Date Dim slut As Date start= Range("p1").Value slut=Range("n3").Value start2=Format(start, "yyyy-mm-dd") slut2=Format(slut, "yyyy-mm-dd")

I get the error on this line: ActiveWorkbook.Connections("Foresp?rgsel fra AVIS").Refresh

I really hope You can help me. Camilla

AnswerEdit

Have you tried adding the opening and closing french braces inside the string you are building with your date variables? I suspect you have an ODBC syhtax error in the new string you are trying to build.

I am not an expert on ODBC and therefore you might want to try another volunteer who knows more about ODBC

Advertisement

©2025 eLuminary LLC. All rights reserved.