Determine if there are values in a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a simple way to determine if there are values in a row in an Access
or SQL Server table (other then the primary key)?

I know one way would be to concatenate the columns by name and test the
length of the resulting string, but I have several tables that have different
column names. Basically, the tables store filtering data to build a where
clause for a report interface and I want to provide a visual alert that a
filter has been set.

I'm wondering if there is a function that does this.

Paco
 
Yes, that would be another option. But that means hard coding the column
names. Is there a way to reference the field name collection without knowing
the column names?
 
There is a Fields collection collection that you could loop through. The code
would depend on whtehr you're using DAO or ADO, but it's pretty simple:
'Air code...
Dim fldThis as Field ' the object type might change here
For Each fldThis in myRecordset.Fields
If fldThis.Value Is Null Then
Blah, blah...
End if
Next
 
Back
Top