Check Box Update

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

Guest

I want to use a check box to indicate when a value in a text box on the form
matches a value in a table. I beleive I can use DLOOKUP to match the values,
but not sure of the syntax or where to put it. I'm am pretty sure it does not
go on Form Load.

Any help is appreciated.
 
Craig Cannon said:
I want to use a check box to indicate when a value in a text box on the form
matches a value in a table. I beleive I can use DLOOKUP to match the values,
but not sure of the syntax or where to put it. I'm am pretty sure it does not
go on Form Load.

Any help is appreciated.

If this is a single view form then the Current event would be the place to do
it. If a continuous view then you would need to use an Expression in a
ControlSource of a TextBox rather than code. In both cases DLookup() could do
the job, but a subquery might be a better choice for the continuous form for
performance reasons.
 
Aaahhhh. (required forehead slap) That makes sense. A calculated field in the
query in which the form is based. This will return 1 or 0 or True or False.

Here's what I did, though.

I added the table to my query so that I could see if there actually were any
items that matched. I added the Symbol column from that table to my query and
setup the join. Since there were I added a text box assigned it to that field
and made it invisible.

I then used the following as the Control Source for the check box.

=IIf(IsNull([SYMBOL]), False, TRUE)

This works like a charm. Comments?
 
Craig Cannon said:
Aaahhhh. (required forehead slap) That makes sense. A calculated field in the
query in which the form is based. This will return 1 or 0 or True or False.

Here's what I did, though.

I added the table to my query so that I could see if there actually were any
items that matched. I added the Symbol column from that table to my query and
setup the join. Since there were I added a text box assigned it to that field
and made it invisible.

I then used the following as the Control Source for the check box.

=IIf(IsNull([SYMBOL]), False, TRUE)

This works like a charm. Comments?

As long as adding the table to your query doesn't cause the records returned to
change or causes the query to lose the ability to do edits then you should be
fine.
 

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