Hi to All,
I run a SELECT query that counts a number of records and it gives the right answer.
When I tried to use it in a VBA Code it gives the following error:
Error 2342: A RunSQL action requires an argument consisting of an SQL statement
Below is my code:
Code:
Dim db As DAO.Database
Set db = CurrentDb
Dim intSQL As String
intSQL = "SELECT Count(fkBookId) AS CountOffkBookId FROM tblBorrowedBooks WHERE fkBookId=" & Forms!frmBooks!pkBookId & " AND DateReturned Is Null;"
DoCmd.RunSQL intSQL
Running the query alone gives me number 2 which is the correct number of records.
Any help is highly appretiated
Khalil