M
merry_fay
Hi,
I need to count the number of records in queries quite a lot to check for
duplicates or to ensure the data I'm about to append hasn't already been
added & then inform the user. I've been using this code to get the count of
records:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQLcnt As String
strSQLcnt = "SELECT Count(…………. etc
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQLcnt)
xx = rs.Fields(0)
rs.Close: Set rs = Nothing
Set db = Nothing
If xx = 0 Then
etc
Is there a simpler or shorter way of doing this as I'm getting some very
long macros when I have to repeat this for 10 different tables in one macro?
Thanks
merry_fay
I need to count the number of records in queries quite a lot to check for
duplicates or to ensure the data I'm about to append hasn't already been
added & then inform the user. I've been using this code to get the count of
records:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQLcnt As String
strSQLcnt = "SELECT Count(…………. etc
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQLcnt)
xx = rs.Fields(0)
rs.Close: Set rs = Nothing
Set db = Nothing
If xx = 0 Then
etc
Is there a simpler or shorter way of doing this as I'm getting some very
long macros when I have to repeat this for 10 different tables in one macro?
Thanks
merry_fay