J
Joe Williams
I am trying to find a way to limit the number of records in a table. I
figured I would just put some code behind the ADD button on a form that ran
some SQL to count the number of records in the table. If the number was
greater than desired, the user would get an error message. Simple enough.
The problem I am having is returning the value of the number of records fomr
the table. The following code represents the way I am trying to do this:
Dim strSQL As String
Dim intRecordCount As Integer
strSQL = "SELECT COUNT(*) AS NumRecords FROM POLICYTYPE"
intRecordCount = DoCmd.RunSQL(strSQL)
When I run this code i get a message "Compile Error: Expected Function or
Variable"
How can I accomplish what I am trying to do? Thanks
Joe
figured I would just put some code behind the ADD button on a form that ran
some SQL to count the number of records in the table. If the number was
greater than desired, the user would get an error message. Simple enough.
The problem I am having is returning the value of the number of records fomr
the table. The following code represents the way I am trying to do this:
Dim strSQL As String
Dim intRecordCount As Integer
strSQL = "SELECT COUNT(*) AS NumRecords FROM POLICYTYPE"
intRecordCount = DoCmd.RunSQL(strSQL)
When I run this code i get a message "Compile Error: Expected Function or
Variable"
How can I accomplish what I am trying to do? Thanks
Joe