SQL query in VBA (ADOdb) script doesn't work

223 views Asked by At

I want to execute query from WinCC SCADA via VBA script. It's simple query, when I execute it on the MS Management Studio - it works well but when i create it in VBA script - it doesn't.

sZapytanie = sZapytanie & " WHERE Data >= '"
sZapytanie = sZapytanie & datastart & "'"

The resulting query is

SELECT * FROM ArchiwizacjaDanych WHERE Data >= '2017-12-16'

This query without "WHERE" statements works well. What is wrong?

The output query from MsgBox is in the picture.

query from MsgBox

1

There are 1 answers

1
Horaciux On

on the phone right now

Replace ( string1, find, replacement, [start, [count, [compare]]] )

make sure you replace "-" with "" or with "0" if day or month <10