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

Reference If Statement Result

P: n/a
I have created and IIF statement in an unbound text box. The IIF
statement produces a text result, ie "On Time", in the unbound text
box. What I would like to do is reffence this text box and then the
result contained in the text box. Something like this:

=Dcount("*","The form where the unbound text box is","TextBox='On
Time'")

How can I get this work work?
Is it possible to reference an unbound text box? (I have read this box
is no longer unbound seeing it has an IIF statement in it)?
Is it possible to reference the result of an IIF statement?

Any help is greatl appreciated.

PS - Where is the best place to begin learning VBA. Most of the books I
have read are way over my head.

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 29 Oct 2005 21:45:31 -0700, "hm*****@hartford.edu"
<hm*****@hartford.edu> wrote:

The expression:
MyTextbox.Value
should yield whatever value is currently in your textbox.
(replace MyTextbox by the name of your control)

-Tom.

I have created and IIF statement in an unbound text box. The IIF
statement produces a text result, ie "On Time", in the unbound text
box. What I would like to do is reffence this text box and then the
result contained in the text box. Something like this:

=Dcount("*","The form where the unbound text box is","TextBox='On
Time'")

How can I get this work work?
Is it possible to reference an unbound text box? (I have read this box
is no longer unbound seeing it has an IIF statement in it)?
Is it possible to reference the result of an IIF statement?

Any help is greatl appreciated.

PS - Where is the best place to begin learning VBA. Most of the books I
have read are way over my head.


Nov 13 '05 #2

P: n/a
Referencing the textbox itself is not a big problem; the bigger issue I see
here is that the second argument of DCount is not the name of a form, but
the name of a table or query. And the table or query, of course, doesn't
contain your unbound textbox.

One way of working around this would be to reuse the criteria in your IIF
statement for the DCount, instead of referencing the unbound textbox:
=DCount("*","MyTable","DatePaid<DateDue")

HTH

<hm*****@hartford.edu> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I have created and IIF statement in an unbound text box. The IIF
statement produces a text result, ie "On Time", in the unbound text
box. What I would like to do is reffence this text box and then the
result contained in the text box. Something like this:

=Dcount("*","The form where the unbound text box is","TextBox='On
Time'")

How can I get this work work?
Is it possible to reference an unbound text box? (I have read this box
is no longer unbound seeing it has an IIF statement in it)?
Is it possible to reference the result of an IIF statement?

Any help is greatl appreciated.

PS - Where is the best place to begin learning VBA. Most of the books I
have read are way over my head.

Nov 13 '05 #3

P: n/a
"hm*****@hartford.edu" <hm*****@hartford.edu> wrote in
news:11**********************@g49g2000cwa.googlegr oups.com:
I have created and IIF statement in an unbound text box. The
IIF statement produces a text result, ie "On Time", in the
unbound text box. What I would like to do is reffence this
text box and then the result contained in the text box.
Something like this:

=Dcount("*","The form where the unbound text box
is","TextBox='On Time'")

How can I get this work work?
Is it possible to reference an unbound text box? (I have read
this box is no longer unbound seeing it has an IIF statement
in it)? Is it possible to reference the result of an IIF
statement?

Any help is greatl appreciated.

PS - Where is the best place to begin learning VBA. Most of
the books I have read are way over my head.

Last questioin firs answer: Try a local community college. Many
have courses in Beginning Basic.

The text box is in a form. you cannot ever reference it with
dcount.

What you need to do is run a dcount on the query that is the
recordsource for the form, using the criterium that goes into
your unbound textbox

DCount("*","query name", _
"WHERE datediff("d",[date1],[date2])> 5"

Or

Modify your query to add a calculated field with the iif
statement, and make the criteria row for that calculated field
"on time". You can then change the textbox on the form to have
the bound field be the version in hte query.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.