A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

check box



 
 
Thread Tools Display Modes
  #1  
Old April 13th, 2008, 03:30 AM posted to microsoft.public.access.tablesdbdesign
binny
external usenet poster
 
Posts: 20
Default check box

how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into the
insurance field
if the box is not checked I want the field to have the default value of 0
--
binny
  #2  
Old April 13th, 2008, 05:50 AM posted to microsoft.public.access.tablesdbdesign
CJ
external usenet poster
 
Posts: 164
Default check box

Hi Binny:

You need to use an IIF function in a query.
Let's say your check box is named Insurance. You would create a calculated
field whose formula might look like this:

InsuranceRate: IIf([Insurance]=True,7.50,0))

--
HTH

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

"binny" wrote in message
...
how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into the
insurance field
if the box is not checked I want the field to have the default value of 0
--
binny





  #3  
Old April 13th, 2008, 09:50 AM posted to microsoft.public.access.tablesdbdesign
binny
external usenet poster
 
Posts: 20
Default check box

Hi CJ
this might sound silly how do you make a calulated field in a table
the only reference I can find is in a query
--
binny


"CJ" wrote:

Hi Binny:

You need to use an IIF function in a query.
Let's say your check box is named Insurance. You would create a calculated
field whose formula might look like this:

InsuranceRate: IIf([Insurance]=True,7.50,0))

--
HTH

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

"binny" wrote in message
...
how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into the
insurance field
if the box is not checked I want the field to have the default value of 0
--
binny





  #4  
Old April 13th, 2008, 04:01 PM posted to microsoft.public.access.tablesdbdesign
Evi
external usenet poster
 
Posts: 898
Default check box

I see what you mean, Binny, you need to store this value in your table
because if the Insurance rate changes then the calculation would change for
past records as well as future ones.
You are being Good and using a form to enter your data, aren't you Binny?

If you are, then, use the After Update Event of your checkbox ie
In the Form's Design View, Click on Properties, Click on your checkbox,
click on the Events tab of Properties.
Click next to After Update.

Choose Event Procedure, click just right of that to open a Code page.

Above the words End Sub, type in

If Me.[Insurance] = True Then
Me.[MyRateField] = 7.5
End if


Because it is in the AfterUpdate Event of the Checkbox, it occurs whenever
the checkbox is updated with a tick.

Change the names, Insurance and MyRateField to the real name of your
controls.

There are a number of refinements you may want to consider.
Do you want this 7.5 to be entered only if you are entering a new record?
Do you want the 7.5 to be removed if you untick the checkbox.

Most importantly, it isn't usually a good idea to enter data (7.5) in code.
You may want to consider creating a table (TblInsuranceRate) which contains
only the current rate and then have the code say

If Me.[Insurance] = True Then
Me.[MyRateField] = DLookup("[InsuranceRate]","TblInsuranceRate")
End if

This makes it easier for you (or another user) to change that field.

Evi









"binny" wrote in message
...
Hi CJ
this might sound silly how do you make a calulated field in a table
the only reference I can find is in a query
--
binny


"CJ" wrote:

Hi Binny:

You need to use an IIF function in a query.
Let's say your check box is named Insurance. You would create a

calculated
field whose formula might look like this:

InsuranceRate: IIf([Insurance]=True,7.50,0))

--
HTH

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

"binny" wrote in message
...
how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into the
insurance field
if the box is not checked I want the field to have the default value

of 0
--
binny







  #5  
Old April 13th, 2008, 10:59 PM posted to microsoft.public.access.tablesdbdesign
binny
external usenet poster
 
Posts: 20
Default check box

thanks I had a feeling VBA code would be involved Access certainly is limited
with out VBA
Putting the insurance rate in another table with an adjustment form is a
good idea,
your right it changes all the time.
--
binny


"Evi" wrote:

I see what you mean, Binny, you need to store this value in your table
because if the Insurance rate changes then the calculation would change for
past records as well as future ones.
You are being Good and using a form to enter your data, aren't you Binny?

If you are, then, use the After Update Event of your checkbox ie
In the Form's Design View, Click on Properties, Click on your checkbox,
click on the Events tab of Properties.
Click next to After Update.

Choose Event Procedure, click just right of that to open a Code page.

Above the words End Sub, type in

If Me.[Insurance] = True Then
Me.[MyRateField] = 7.5
End if


Because it is in the AfterUpdate Event of the Checkbox, it occurs whenever
the checkbox is updated with a tick.

Change the names, Insurance and MyRateField to the real name of your
controls.

There are a number of refinements you may want to consider.
Do you want this 7.5 to be entered only if you are entering a new record?
Do you want the 7.5 to be removed if you untick the checkbox.

Most importantly, it isn't usually a good idea to enter data (7.5) in code.
You may want to consider creating a table (TblInsuranceRate) which contains
only the current rate and then have the code say

If Me.[Insurance] = True Then
Me.[MyRateField] = DLookup("[InsuranceRate]","TblInsuranceRate")
End if

This makes it easier for you (or another user) to change that field.

Evi









"binny" wrote in message
...
Hi CJ
this might sound silly how do you make a calulated field in a table
the only reference I can find is in a query
--
binny


"CJ" wrote:

Hi Binny:

You need to use an IIF function in a query.
Let's say your check box is named Insurance. You would create a

calculated
field whose formula might look like this:

InsuranceRate: IIf([Insurance]=True,7.50,0))

--
HTH

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

"binny" wrote in message
...
how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into the
insurance field
if the box is not checked I want the field to have the default value

of 0
--
binny







  #6  
Old April 14th, 2008, 11:57 PM posted to microsoft.public.access.tablesdbdesign
Evi
external usenet poster
 
Posts: 898
Default check box

Don't feel uneasy about using VBA, Binny. It actually makes more sense than
you would think In fact, you will eventually get to the stage where you
find Excel annoying because its VBA is so limited.

If you are unsure about any of the stages of using it, please say so and we
can step you through it. Supply your exact InsuranceRate Table name (if you
decide to use one) and field names if you are still unsure about how to edit
the code I wrote below and I will put them into the code so that you can see
them in situe

Evi

"binny" wrote in message
...
thanks I had a feeling VBA code would be involved Access certainly is

limited
with out VBA
Putting the insurance rate in another table with an adjustment form is a
good idea,
your right it changes all the time.
--
binny


"Evi" wrote:

I see what you mean, Binny, you need to store this value in your table
because if the Insurance rate changes then the calculation would change

for
past records as well as future ones.
You are being Good and using a form to enter your data, aren't you

Binny?

If you are, then, use the After Update Event of your checkbox ie
In the Form's Design View, Click on Properties, Click on your checkbox,
click on the Events tab of Properties.
Click next to After Update.

Choose Event Procedure, click just right of that to open a Code page.

Above the words End Sub, type in

If Me.[Insurance] = True Then
Me.[MyRateField] = 7.5
End if


Because it is in the AfterUpdate Event of the Checkbox, it occurs

whenever
the checkbox is updated with a tick.

Change the names, Insurance and MyRateField to the real name of your
controls.

There are a number of refinements you may want to consider.
Do you want this 7.5 to be entered only if you are entering a new

record?
Do you want the 7.5 to be removed if you untick the checkbox.

Most importantly, it isn't usually a good idea to enter data (7.5) in

code.
You may want to consider creating a table (TblInsuranceRate) which

contains
only the current rate and then have the code say

If Me.[Insurance] = True Then
Me.[MyRateField] = DLookup("[InsuranceRate]","TblInsuranceRate")
End if

This makes it easier for you (or another user) to change that field.

Evi









"binny" wrote in message
...
Hi CJ
this might sound silly how do you make a calulated field in a table
the only reference I can find is in a query
--
binny


"CJ" wrote:

Hi Binny:

You need to use an IIF function in a query.
Let's say your check box is named Insurance. You would create a

calculated
field whose formula might look like this:

InsuranceRate: IIf([Insurance]=True,7.50,0))

--
HTH

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

"binny" wrote in message
...
how do I enter a value into field using a check box
if the insurance check box is checked I want to enter $7.50 into

the
insurance field
if the box is not checked I want the field to have the default

value
of 0
--
binny









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.