Evaluate select statement in code, see if it returns anything or not

  • Thread starter Thread starter melwheels
  • Start date Start date
M

melwheels

Hello all,

I have a feeling what I am looking for is amazingly simple, yet it
eludes me :(

On a form, I have a combo box. I am populating the box differently
depending whether or not certain factors are met.

To determine if the factors are met, I have a SELECT statement
written. If the statement returns nothing, then the list should be
populated one way, if there are records returned, it should be
populated another way.

My problem is that I can't seem to figure out how to get this working
right. I guess if I could write this:

if isnull(SELECTSTATEMENT) then
one thing
else
the other thing
end if

Obviously, it's the if/then that I find problematic. Any pointers much
appreciated.

Thanks a million :)
 
Hello all,

I have a feeling what I am looking for is amazingly simple, yet it
eludes me :(

On a form, I have a combo box. I am populating the box differently
depending whether or not certain factors are met.

To determine if the factors are met, I have a SELECT statement
written. If the statement returns nothing, then the list should be
populated one way, if there are records returned, it should be
populated another way.

My problem is that I can't seem to figure out how to get this working
right. I guess if I could write this:

if isnull(SELECTSTATEMENT) then
one thing
else
the other thing
end if

Obviously, it's the if/then that I find problematic. Any pointers much
appreciated.

Thanks a million :)

If CurrentDB.OpenRecordset("SELECT Statement").RecordCount > 0 Then...
 
Is that select statement a query already???

if dcount("*", "NameOfYourquery") > 0 then
one thing - for we have records
else
we don't have reocrds...
end if
 
Rick, thanks, I'll try that. I assume I can "throw" the statement in
a string and call the string instead? I'll play.

Albert, no, it's not a named query, and won't be. Thanks for the
response though.

Mel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top