I am trying to count how many records has a table with a special value (SolicitaçãoID.Text) but I keep getting error:
Compile Erro:
User-Defined not defined
And it goes to this line: Dim db As DAO.Database
This is the command:
Private Sub CmdAmostra_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intResult As Integer
Dim strSQL As String
Set db = CurrentDb
SolicitaçãoID.SetFocus
strSQL = "SELECT COUNT (*) As RecordCount FROM Protocol
where SolicitaçãoID=" & SolicitaçãoID.Text
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
intResult = rs("RecordCount")
MsgBox intResult
Amostras.SetFocus
Amostras.Text = intResult
rs.Close
db.Close
End Sub
Well i have no clue what that error means and why.
Thanks for the Help
Art
Compile Erro:
User-Defined not defined
And it goes to this line: Dim db As DAO.Database
This is the command:
Private Sub CmdAmostra_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intResult As Integer
Dim strSQL As String
Set db = CurrentDb
SolicitaçãoID.SetFocus
strSQL = "SELECT COUNT (*) As RecordCount FROM Protocol
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
intResult = rs("RecordCount")
MsgBox intResult
Amostras.SetFocus
Amostras.Text = intResult
rs.Close
db.Close
End Sub
Well i have no clue what that error means and why.
Thanks for the Help
Art