Connecting Tech Pros Worldwide Help | Site Map

help with check boxes

Kai St-Louis
Guest
 
Posts: n/a
#1: Nov 12 '05
Hi, I am trying to show a value in a field when a check box is checked,
example: if the box is checked, value of $ 15.00 appears. What is the
function or expression for this?

Thank you

Kai St-Louis


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003


Bruce M. Thompson
Guest
 
Posts: n/a
#2: Nov 12 '05

re: help with check boxes


> Hi, I am trying to show a value in a field when a check box is checked,[color=blue]
> example: if the box is checked, value of $ 15.00 appears. What is the
> function or expression for this?[/color]

If this value is to be displayed in a calculated control (the value isn't going
to be stored), then you can set the control's "control source" to:

=IIF(Me.chkBox.Value, 15, 0)

If you want to assign the value to a control bound to a field in the form's
recordsource you could do it this way:

'****
If Me.chkBox.Value Then
Me.MyControlName.Value = 15
Else
Me.MyControlName.Value = 0 'Or "Null", if more appropriate
End If
'****

In either of the examples above, set the control's "Format" property to
"Currency".

I generally discourage the use of hard-coded values, so, if this value is likely
to change you should store it in a table and then you can look it up using the
"DLookup()" function or a recordset when needed.

--
Bruce M. Thompson
bthmpson@mvps.org (See the Access FAQ at http://www.mvps.org/access)[color=blue][color=green]
>> NO Email Please. Keep all communications[/color][/color]
within the newsgroups so that all might benefit.<<


Closed Thread