Checkbox Question

D

Duncs

I've got a form from which agents take details and check other
systems. As they complete each step of the process--there are 12 of
them--I want them to click a checkbox to confirm they have completed
the step. Only when all twelve steps have been completed, will the
main 'Update' button become active and allow them to mark the
transaction as complete and save the details--details saved are date
started, date completed, user id etc.

The form itself has no data source, with the fields being populated
via VBA. As a result, all controls are unbound. I've added the
twelve checkboxes, but I can't get them to work. I don't need / want
to store the values in the checkboxes, I just need to know when all
twelve have been selected. But, as I said, click as I might on the
checkbox, and it does nothing...no tick is displayed.

Anyone help?

TIA

Duncs
 
M

Mr. B

One possible solution is to declare a public variable as byte type.
Initilize this variable to zero when your form opens. Then use code in the
after update event of each of your check boxes like:

If me.NameOfCurrentCheckBox = true then
YourNewVariable = YourNewVariable + 1
else
YourNewVariable = YourNewVariable - 1
end if

If YourNewVariable = 12 then
Me.NameOfUpdateButton.Enable = true
else
Me.NameOfUpdateButton.Enable = false
end if

The code above is "air code" and is not tested.

This solution assumes that all check boxes are always uncheck when the form
opens.

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
 
D

Duncs

Mr. B,

I had the issue of the checkboxes not showing a tick. I then realised
I was adding them to the form incorrectly. This has now been
resolved, and I get a tick...however, I have another problem now...

If I click on the 1st checkbox, it does indeed display a tick.
However, if I click on it again, it still displays a tick. Also, if I
click on any of the other checkboxes, the tick from the first one
disappears, and the one just clicked on now has a tick in it!!

What am I missing?

TIA

Duncs
 
P

Petr Danes

Hi Duncs,

Sounds like you may have put your check boxes in an option group. Controls
in a group are mutually exclusive, which is generally what you want for
option buttons (the round ones with a dot in the middle, also called radio
buttons) and generally NOT what you want for check boxes. If you want them
to act independently of each other, they must not be in a group. (If they're
inside a box with a label at the top, it's probably a group. If you simply
want them in a graphic box, but not as members of an option group, use the
frame control, not the group control.)

Pete



"Duncs" <[email protected]> píse v diskusním príspevku
Mr. B,

I had the issue of the checkboxes not showing a tick. I then realised
I was adding them to the form incorrectly. This has now been
resolved, and I get a tick...however, I have another problem now...

If I click on the 1st checkbox, it does indeed display a tick.
However, if I click on it again, it still displays a tick. Also, if I
click on any of the other checkboxes, the tick from the first one
disappears, and the one just clicked on now has a tick in it!!

What am I missing?

TIA

Duncs
 
D

Duncs

Pete,

That's what it was. I had copied the frame, an option group, and put
the checkboxes in it. I've now corrected this, and it works great.

Cheers

Duncs
 
P

Petr Danes

Great, glad it helped.

Pete



"Duncs" <[email protected]> píse v diskusním príspevku
Pete,

That's what it was. I had copied the frame, an option group, and put
the checkboxes in it. I've now corrected this, and it works great.

Cheers

Duncs
 
J

James A. Fortune

Mr. B said:
One possible solution is to declare a public variable as byte type.
Initilize this variable to zero when your form opens. Then use code in the
after update event of each of your check boxes like:

If me.NameOfCurrentCheckBox = true then
YourNewVariable = YourNewVariable + 1
else
YourNewVariable = YourNewVariable - 1
end if

If YourNewVariable = 12 then
Me.NameOfUpdateButton.Enable = true
else
Me.NameOfUpdateButton.Enable = false
end if

The code above is "air code" and is not tested.

This solution assumes that all check boxes are always uncheck when the form
opens.

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm

Mr. T.B.,

I give myself poor advice at times also. I think your proposed solution
has some potential weaknesses. For example, you have minimal protection
against your count staying synchronized with the checkboxes. Since
you're using the AfterUpdate event for each checkbox anyway, why not
just call a Boolean function (behind the form) that looks at the actual
state of the checkboxes. As soon as it sees any that are not checked,
it can exit the function early and return False.

BTW, I'm aware that your actual surname is of ancient Scottish ancestry,
predating even the Norman Invasion (1066), when many of the British
surnames in common use today were created, by at least four centuries.
I checked on the Fortune name when I visited Edinburgh. Someone named
Fortune lived briefly in Scotland around 1100, but there was never a
Fortune Clan of any kind in Scotland AFAICT. But that doesn't mean I
don't have some notorious ancestors.

According to cousins related to me by my maternal grandfather, I am
apparently directly related to a cousin of Kaiser Wilhelm II, which
opens up a whole other can of notoriety.

Based on the fact that my paternal grandfather and his brother moved to
Michigan from Virginia to start a paper mill like the one they had on
the James River, and from his stories, I am directly related to the
Fortune family of Virginia descended from a settler who arrived in
Virginia from Wales in the early 1700's. That family had a couple of
generations of brother/sister marriages, so 'd have to classify my
paternal ancestors as rednecks :). According to my research, nearly
all the people with the surname Fortune in the U.S., i.e., those where
the family did not acquire the surname later, are related to that common
ancestor. My maternal ancestors were the result of a family line of
revolutionaries and a family line of royalists eventually meeting as
they migrated west. A couple of my ancestors came to the U.S. as a
result of the Irish Potato Famine circa 1850. Given the duplicity of
the famous botanist named Fortune

http://en.wikipedia.org/wiki/Robert_Fortune

who snuck into China pretending to be Chinese when Europeans weren't
allowed, in order to smuggle out botanical samples, not to mention
Fortune family activities designed to keep moonshine from Revenuers
during Prohibition along the James River, I'm not the best one to
criticize your actions. There was even an industrial magnate named
Fortune on the Titanic who perhaps inspired the bad guy in the movie :).

James A. Fortune
(e-mail address removed)

One of your ancestors was drinking heavily with Henry Ford Jr. in
northern Michigan. Henry Ford Sr., being a teetotaler, didn't
appreciate that his son liked to get drunk. They both got pretty wasted
and Henry Ford Jr. accidentally ran over his leg with an early
automobile and broke it. He was so drunk I doubt he even felt it. My
brother James Heacock, was an executive at Ford's until he died in the
90's. -- My grandfather

Note: People from Michigan usually say Ford's instead of Ford.
 

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

Similar Threads


Top