check if table is empty

  • Thread starter Thread starter andrewbda
  • Start date Start date
A

andrewbda

How do I check if a table is empty in access?

I need to run different VB depending on if a certain table is empty or
not.

Thanks!
 
How do I check if a table is empty in access?

I need to run different VB depending on if a certain table is empty or
not.

Thanks!

You could do a select count on the table to determine the number of records
....
 
Load the table in your dataadapter and then

If dstest.Tables(0).Rows.Count = -1 Then
MsgBox("EMPTY")
End If
 
Hi,

you could try either

dim dt as datatable

if dt.columns.count=0 then msgbox("Table has no columns")

or

dt.rows.count=0 then msgbox ("Table has no rows.")

depending on your meaning of 'empty'

HTH

Martin
 
Use the COUNT SQL function to return a count of rows. If the result is zero,
the table is empty.

SELECT COUNT(*) FROM Table1
 
Back
Top