Here's a function that will tell you if you have records in a Table.
You'll have to make changes to fit your Database.
Code:
Function Get_Row_Count()
'Get number of rows in a table using a query in VBA.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intField1 as Integer
On Error GoTo Error_Handle
Set db = CurrentDb
strSQL = "Select Count(*) As NumberOfRecords From [AA_Test]"
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
With rs
Do While Not rs.EOF
intField1 = rs![NumberOfRecords]
msgbox strField1
'Instead of the msgbox - you can put your logic here . . .
'Eg:
If intField1 = 0 Then
'Do something
End If
.MoveNext 'Move to next record in recordset.
Loop 'Back to 'Do While' to check if we are at the end of the file.
Exit_Get_DB_Values:
If Not rs Is Nothing Then
rs.Close
Set rs = Nothing
End If
Set db = Nothing
Exit Function
Error_Handle:
Resume Exit_Get_DB_Values
End With
End Function
I hope this helps! Let me know if you have any questions.