Gossamer Forum
Home : General : Databases and SQL :

Access Quey

Quote Reply
Access Quey
I'm actually trying to execute a select query from the VB code of a Access from event.
I'he tried some different way as :
Dim rs_presence As Recordset
requete_presence = "SELECT name FROM Strategy WHERE name LIKE '" & strategie.Value & "';"
Set rs_presence = CurrentDb().OpenRecordset(requete_presence, , , dbReadOnly)
And I've got a Message Box with "Invalid Argument"
I've also tried with the queryDefs but the declaration of my QueryDef var give me a nice Message Box with
Compil error:
User-defined type not defined
Nevertheless I manage to execute an update like that :
Dim insertion As String
insertion = "INSERT INTO Strategy (name) VALUES ('" & strategie.Value & "');"
CurrentDb().Execute (insertion)
So, I juste need to know how to execute a select query.