Turning record fields into checkboxes on a form

  • Thread starter Thread starter Santiago Gomez
  • Start date Start date
S

Santiago Gomez

I have a table showing when a particular piece of equipment is active on a
site, and how much energy it requires. The machine may not be on the entire
year.

J2001 | F2001 | M2001 | A2001
23 | 23 | | 23 |

I want to display that data on a form but using checkboxes to show when
something is on or off (I dont want to show the value, just a check if there
is something, or no check if it is null)

Furthermore, ifthe user checks a unchecked box, I want a value from a txt
box on the form to be inserted in that field.

does this make sense?

thanks for any help.
 
Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use the On
Click event of the checkbox to set a value in your table.
 
that's good, it shows whether it's on or off, but I am having trouble
changing it's status.

I want to click on it, and have it turn off or on. I imagine an if statement
will work here, but when I add something to the click event the status bar
says that 'Control cant be edited. It's bound to the expresion
=IsNull([F2001])=False

is there another way to link the checkboxes directly to the fields?

thanks


Duane Hookom said:
Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use the On
Click event of the checkbox to set a value in your table.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
I have a table showing when a particular piece of equipment is active on a
site, and how much energy it requires. The machine may not be on the entire
year.

J2001 | F2001 | M2001 | A2001
23 | 23 | | 23 |

I want to display that data on a form but using checkboxes to show when
something is on or off (I dont want to show the value, just a check if there
is something, or no check if it is null)

Furthermore, ifthe user checks a unchecked box, I want a value from a txt
box on the form to be inserted in that field.

does this make sense?

thanks for any help.
 
What value would you want to put into the field? You could trap for the
error and ignore it. Add code to insert a value into the table and then
requery the form.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
that's good, it shows whether it's on or off, but I am having trouble
changing it's status.

I want to click on it, and have it turn off or on. I imagine an if statement
will work here, but when I add something to the click event the status bar
says that 'Control cant be edited. It's bound to the expresion
=IsNull([F2001])=False

is there another way to link the checkboxes directly to the fields?

thanks


Duane Hookom said:
Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use the On
Click event of the checkbox to set a value in your table.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
I have a table showing when a particular piece of equipment is active
on
 
When the user checks the box I want the value form a calculated field on the
same form (txtCalculatedField) to be inserted into the field.

for example, if an electrical load is only needed during the summer (air
conditioning) the user will check only the boxes under June, July, August.
The calculated field from the form that tells us how much the load is should
be inserted under those months (fields on a table) so we can run totals in
the end. make sense?

ps. the table actually has 84 + fields. each month from 2001 thru 2007!

thanks

Duane Hookom said:
What value would you want to put into the field? You could trap for the
error and ignore it. Add code to insert a value into the table and then
requery the form.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
that's good, it shows whether it's on or off, but I am having trouble
changing it's status.

I want to click on it, and have it turn off or on. I imagine an if statement
will work here, but when I add something to the click event the status bar
says that 'Control cant be edited. It's bound to the expresion
=IsNull([F2001])=False

is there another way to link the checkboxes directly to the fields?

thanks


Duane Hookom said:
Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use the On
Click event of the checkbox to set a value in your table.

--
Duane Hookom
MS Access MVP


I have a table showing when a particular piece of equipment is
active
 
Your table is seriously un-normalized. Months should be data values in
fields not field names.
You should be able to place code in the on click event that either updates
or appends a record based on the status of the check box. Then you would
need to requery the form.

I wouldn't go any further until the table structure was normalized.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
When the user checks the box I want the value form a calculated field on the
same form (txtCalculatedField) to be inserted into the field.

for example, if an electrical load is only needed during the summer (air
conditioning) the user will check only the boxes under June, July, August.
The calculated field from the form that tells us how much the load is should
be inserted under those months (fields on a table) so we can run totals in
the end. make sense?

ps. the table actually has 84 + fields. each month from 2001 thru 2007!

thanks

Duane Hookom said:
What value would you want to put into the field? You could trap for the
error and ignore it. Add code to insert a value into the table and then
requery the form.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
that's good, it shows whether it's on or off, but I am having trouble
changing it's status.

I want to click on it, and have it turn off or on. I imagine an if statement
will work here, but when I add something to the click event the status bar
says that 'Control cant be edited. It's bound to the expresion
=IsNull([F2001])=False

is there another way to link the checkboxes directly to the fields?

thanks


Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use the On
Click event of the checkbox to set a value in your table.

--
Duane Hookom
MS Access MVP


I have a table showing when a particular piece of equipment is
active
on
a
site, and how much energy it requires. The machine may not be on the
entire
year.

J2001 | F2001 | M2001 | A2001
23 | 23 | | 23 |

I want to display that data on a form but using checkboxes to show when
something is on or off (I dont want to show the value, just a
check
from
 
you were right, I suspected that when I inherited the database and I though
I could get away without normalizing it. I should have followed the rules.

I am now testing the normalized database and have reached the same impass,
how to link the checkboxes to actual controls and let them be interactive.

I've started a new post under Forms, Subject: Re: Checkboxes on a subform
linked to a query

I look forward to you input.

Thanks

Santiago

Duane Hookom said:
Your table is seriously un-normalized. Months should be data values in
fields not field names.
You should be able to place code in the on click event that either updates
or appends a record based on the status of the check box. Then you would
need to requery the form.

I wouldn't go any further until the table structure was normalized.

--
Duane Hookom
MS Access MVP


Santiago Gomez said:
When the user checks the box I want the value form a calculated field on the
same form (txtCalculatedField) to be inserted into the field.

for example, if an electrical load is only needed during the summer (air
conditioning) the user will check only the boxes under June, July, August.
The calculated field from the form that tells us how much the load is should
be inserted under those months (fields on a table) so we can run totals in
the end. make sense?

ps. the table actually has 84 + fields. each month from 2001 thru 2007!

thanks

Duane Hookom said:
What value would you want to put into the field? You could trap for the
error and ignore it. Add code to insert a value into the table and then
requery the form.

--
Duane Hookom
MS Access MVP


that's good, it shows whether it's on or off, but I am having trouble
changing it's status.

I want to click on it, and have it turn off or on. I imagine an if
statement
will work here, but when I add something to the click event the
status
bar
says that 'Control cant be edited. It's bound to the expresion
=IsNull([F2001])=False

is there another way to link the checkboxes directly to the fields?

thanks


Add check boxes with control source of:
=IsNull([F2001])=False
This check box will be un-editable but you should be able to use
the
On
Click event of the checkbox to set a value in your table.

--
Duane Hookom
MS Access MVP


I have a table showing when a particular piece of equipment is active
on
a
site, and how much energy it requires. The machine may not be on the
entire
year.

J2001 | F2001 | M2001 | A2001
23 | 23 | | 23 |

I want to display that data on a form but using checkboxes to show
when
something is on or off (I dont want to show the value, just a
check
if
there
is something, or no check if it is null)

Furthermore, ifthe user checks a unchecked box, I want a value
from
a
txt
box on the form to be inserted in that field.

does this make sense?

thanks for any help.
 
Back
Top