PDA

View Full Version : [VBA + ACCESS] eseguire un comando sql


disumano
27-05-2005, 15:04
se eseguo questo codice in vba

Private Sub CasellaCombinata3_Click()
Dim strsql As String
strsql = "SELECT * FROM attive where cliente ='" & CasellaCombinata3.text & "';"
DoCmd.RunSQL strsql
End Sub

ho questo errore:

Errore di runtime 2342:
Un'azione eseguiSQL richiede un argomento costituito da un'istruzione sql

come risolvo?
grazie

RaouL_BennetH
27-05-2005, 15:47
nel caso tu abbia usato ADO per connetterti al db:
e per esempio tu abbia chiamato il tuo recordset "rs" e la tua connessione "cn"




Private Sub CasellaCombinata3_Click()
Dim strsql As String
strsql = "SELECT * FROM attive where cliente ='" & CasellaCombinata3.text & "';"

Set rs = cn.Execute(strsql)

End Sub