I have a VBS program that works great. My code below:
Dim qry, db, cs, cn, cmd
'Query to add all the following which date more than 20 days in the table ToUnfollow
qry = "INSERT INTO ToUnfollow " & _
"SELECT Name FROM Follow t1 " & _
"WHERE t1.Joined < datetime(CURRENT_DATE, '-20 days') " & _
"AND NOT EXISTS (SELECT 1 FROM ToUnfollow t2 WHERE t2.Name=t1.Name);"
db = "C:\Users\Quentin\Downloads\Quentin-Classementhashtags.db"
cs = "DRIVER=SQLite3 ODBC Driver;Database=" & db
'Connection to database
Set cn = CreateObject("ADODB.Connection")
cn.Open cs
Set cmd = CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
'Execute the SQL query
cmd.CommandText = qry
cmd.Execute
'Close the connection
cn.Close
I want to display all records from the SQL query in a MsgBox
. I tried several solutions from several forums but none works for me.