PC Review


Reply
Thread Tools Rate Thread

Determine if there are values in a table

 
 
=?Utf-8?B?UGFjbw==?=
Guest
Posts: n/a
 
      4th May 2006
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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmFycnkgR2lsYmVydA==?=
Guest
Posts: n/a
 
      4th May 2006
Can't you just test for null in each column?

"Paco" wrote:

> 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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?UGFjbw==?=
Guest
Posts: n/a
 
      4th May 2006
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?

"Barry Gilbert" wrote:

> Can't you just test for null in each column?
>
> "Paco" wrote:
>
> > 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
> >
> >
> >

 
Reply With Quote
 
=?Utf-8?B?QmFycnkgR2lsYmVydA==?=
Guest
Posts: n/a
 
      4th May 2006
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



"Paco" wrote:

> 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?
>
> "Barry Gilbert" wrote:
>
> > Can't you just test for null in each column?
> >
> > "Paco" wrote:
> >
> > > 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
> > >
> > >
> > >

 
Reply With Quote
 
Tim Ferguson
Guest
Posts: n/a
 
      5th May 2006
=?Utf-8?B?QmFycnkgR2lsYmVydA==?= <(E-Mail Removed)>
wrote in news:5D47D526-9967-43CB-817F-(E-Mail Removed):

> If fldThis.Value Is Null Then


ITYM

If IsNull(fldThis.Value) Then


Tim F

 
Reply With Quote
 
=?Utf-8?B?UGFjbw==?=
Guest
Posts: n/a
 
      5th May 2006
Problem solved. I knew there had to be a simpler way.

Thanks.

"Tim Ferguson" wrote:

> =?Utf-8?B?QmFycnkgR2lsYmVydA==?= <(E-Mail Removed)>
> wrote in news:5D47D526-9967-43CB-817F-(E-Mail Removed):
>
> > If fldThis.Value Is Null Then

>
> ITYM
>
> If IsNull(fldThis.Value) Then
>
>
> Tim F
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine the values? Eric Microsoft Excel Misc 1 5th Jun 2010 04:35 AM
How to determine the values? Eric Microsoft Excel Misc 4 11th Dec 2009 07:29 AM
How to determine the values within table? Eric Microsoft Excel Misc 0 6th Mar 2009 01:22 AM
How to determine the values? Eric Microsoft Excel Misc 1 24th Aug 2008 11:24 AM
How to determine the values? Eric Microsoft Excel Worksheet Functions 6 2nd May 2008 12:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:52 PM.