By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,656 Members | 1,762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,656 IT Pros & Developers. It's quick & easy.

Need Help Understanding How To Make This Work

P: n/a
I have created a database application that uses a macro, activated by a
button click event, that runs a query which returns a recordset
consisting of a subset of the matching database record, and displays the
data within a form. The query on the table produces a recordset based
on the matching criteria consisting of a person's first and last name,
or fields ClientFirstname and ClientLastname, respectively. I've
programmed the application to display the recordset in the form only if
a third field, AgentName, in the record has a null value. If the
AgentName field is not null, then no record is displayed because the
query will return a null recordset.

Now, with this backdrop, here is my goal: I'm trying to determine the
VBA code that would determine whether a recordset returned by a query is
null or not. Then, if the recordset is null, I want to have other VBA
code run an another query to yield the same subset of data fields and
display them in a replica of the first form, but this time, I want to
display the actual value of the AgentName field along with the other
data in the record as defined by the form. I hope this is clear.

Essentially, what I need to know this: what is the syntax of VBA code
that can be used to determine whether or not a recordset returned by a
query is null or not null? Thanking anyone in advance for their help
with this problem.
Jan 29 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Donald Calloway <dr********@verizon.netwrote in
news:lnvnj.7230$v86.6825@trnddc08:
I have created a database application that uses a macro, activated
by a button click event, that runs a query which returns a
recordset consisting of a subset of the matching database record,
and displays the data within a form. The query on the table
produces a recordset based on the matching criteria consisting of
a person's first and last name, or fields ClientFirstname and
ClientLastname, respectively. I've programmed the application to
display the recordset in the form only if a third field,
AgentName, in the record has a null value. If the AgentName field
is not null, then no record is displayed because the query will
return a null recordset.

Now, with this backdrop, here is my goal: I'm trying to determine
the VBA code that would determine whether a recordset returned by
a query is null or not. Then, if the recordset is null, I want to
have other VBA code run an another query to yield the same subset
of data fields and display them in a replica of the first form,
but this time, I want to display the actual value of the AgentName
field along with the other data in the record as defined by the
form. I hope this is clear.

Essentially, what I need to know this: what is the syntax of VBA
code that can be used to determine whether or not a recordset
returned by a query is null or not null? Thanking anyone in
advance for their help with this problem.
Why go to all that trouble?

Code the onClick event to open the form directly, with the first and
last name criteria, and set a filter on the form to show only the
records with null agent_name. If the form's recordset is empty,
based on the simple test of recordcount being 0, then remove the
filter.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.