B
Bataille Jean-Paul
Hi !
I want to use a SQL COUNT request in a VBA code but i don't succeed why and
how can go my way to success ?
I work on ACCESS 97 but i'm interested in the ACCESS2002 too.
Here under is my code (ACCESS 97)
sub TST ()
Dim strSQL As String
Dim RST As Recordset
Dim Val As Long
'THE SQL REQUEST
strSQL = "SELECT Count(Clé_Contrat) AS Nbr " & _
"FROM R_Contrat_Fluide_finale " & _
"WHERE (((R_Contrat_Fluide_finale.Clé2_SAP)=109));"
Set Bdd = CurrentDb
Set RST = CurrentDb.OpenRecordset(strSQL)
Val = RST(0)
MsgBox (Val)
End Sub
Thanks for your help,
And HAPPY NEW YEAR
JPB
I want to use a SQL COUNT request in a VBA code but i don't succeed why and
how can go my way to success ?
I work on ACCESS 97 but i'm interested in the ACCESS2002 too.
Here under is my code (ACCESS 97)
sub TST ()
Dim strSQL As String
Dim RST As Recordset
Dim Val As Long
'THE SQL REQUEST
strSQL = "SELECT Count(Clé_Contrat) AS Nbr " & _
"FROM R_Contrat_Fluide_finale " & _
"WHERE (((R_Contrat_Fluide_finale.Clé2_SAP)=109));"
Set Bdd = CurrentDb
Set RST = CurrentDb.OpenRecordset(strSQL)
Val = RST(0)
MsgBox (Val)
End Sub
Thanks for your help,
And HAPPY NEW YEAR
JPB