Sql, Vba & Iif

shkrebs

Registered User.
Local time
Today, 11:05
Joined
Jun 7, 2002
Messages
60
Hi there.

None of my books describes how to "breake" a SQL statement which is more than 255 char. long??

Following statement gives me some trouble...:
Sum(IIf([divisa]="PTS",([Importe Neto]/[Cambio]),[Importe Neto])) AS FactSin

I've tried with #, &, ', and a lot of other char but I can't find a way so VBA don't think "PTS" is the end of the strSQL :-(

Any ideas???

Best regards
Soren
 
Try rewritting it like this:

Sum(IIf([divisa]='PTS',([Importe Neto]/[Cambio]),[Importe Neto])) AS FactSin

Or

Sum(IIf([divisa]=""PTS"",([Importe Neto]/[Cambio]),[Importe Neto])) AS FactSin
 
Hmmm - I'm sure I tried that combination, but .......... :)

Do U also happen to know how to "break" a looooong SQL line in VBA?¿?¿¿?¿?¿ :D

Thanks so much, Travis.

Soren
 
SQL="Select [Field1],[Field2], " & _
"[Field3], [Field4], [Field5] " & _
"From [TableName] " & _
"Where [Field1]='Value'"
 

Users who are viewing this thread

Back
Top Bottom