Check box

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

Guest

I have created a table called tblCompanyInvolvments. It has fields that are
CompanyID, CategoryID, and Involvement. Involvement is a Yes/no field. I
would like to create a form that shows all the categories as text labels with
a check box next to it, and when a check box is ticked it will automatically
add that record to the table. The amount of categories will never change,
and i would like to have this type of set up because it mirrors other
software that my company is currently using. This would make it easier on
end uesrs to also use this software. Thank you very much for any help you
can provide.
 
J,
Do you mean that if chkXYZ is True you want Involvement to be set to "XYZ", and chkABC
would set Involvement to "ABC"?
I'd use an OptionGroup where only 1 involvement could be checked.
Set chkXYZ OptionValue to 1, chkABC to 2, etc..
On the AfterUpdate of the OptionGroup (ex. name optInvolvement)
If chkInvolvement = 1 Then
Me.[Involvement] = "XYZ"
ElseIf chkInvolvement = 2 Then
Me.[Involvement] = "ABC"
etc....
End If
(you could use a SelectCase instead of IF)

The advantage of an OptionGroup is... only one choice allowed, and only one
AfterUpdate to code.
The procedure would be the same if you used separate check boxes... coding each
checkbox for it appropriate Involvement value.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Sorry i should have been more clear about this matter. I have since changed
my table so that there are 2 fields: CompanyID and CategoryID. The
CategoryID links to tblCategories and represents the areas of involvement for
that company. Because there are can be more than one area of involvement for
a company, i cannot use the option group. But further down you say that i
can do the same for check boxes. For what i would like to do it seems like
it might be a lot coding. So pseudo code style:

if checkboxA = True
'Use append query to insert CompanyID and CategoryID into
tblCompanyInvolvements
elseif checkboxA = False
'Use delete query to remove CompanyID and Category from
tblCompanyInvolvements

This coding would be placed in the AfterUpdate section for each checkbox, of
course changing the name of the checkbox to mirror the correct name. Is this
correct?

Al Campagna said:
J,
Do you mean that if chkXYZ is True you want Involvement to be set to "XYZ", and chkABC
would set Involvement to "ABC"?
I'd use an OptionGroup where only 1 involvement could be checked.
Set chkXYZ OptionValue to 1, chkABC to 2, etc..
On the AfterUpdate of the OptionGroup (ex. name optInvolvement)
If chkInvolvement = 1 Then
Me.[Involvement] = "XYZ"
ElseIf chkInvolvement = 2 Then
Me.[Involvement] = "ABC"
etc....
End If
(you could use a SelectCase instead of IF)

The advantage of an OptionGroup is... only one choice allowed, and only one
AfterUpdate to code.
The procedure would be the same if you used separate check boxes... coding each
checkbox for it appropriate Involvement value.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

JKarchner said:
I have created a table called tblCompanyInvolvments. It has fields that are
CompanyID, CategoryID, and Involvement. Involvement is a Yes/no field. I
would like to create a form that shows all the categories as text labels with
a check box next to it, and when a check box is ticked it will automatically
add that record to the table. The amount of categories will never change,
and i would like to have this type of set up because it mirrors other
software that my company is currently using. This would make it easier on
end uesrs to also use this software. Thank you very much for any help you
can provide.
 
Well, I would guess that would work... can't hurt to give it a go.
I'm not sure why you wouldn't just enter multiple Involvement values using a small
subform, related via CompanyID using a combobox to facilitate multiple possible values.
(One Company Many Involvements, with CategoryID and Involvement values in a unrelated
table to feed the combo)
You're call though...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


JKarchner said:
Sorry i should have been more clear about this matter. I have since changed
my table so that there are 2 fields: CompanyID and CategoryID. The
CategoryID links to tblCategories and represents the areas of involvement for
that company. Because there are can be more than one area of involvement for
a company, i cannot use the option group. But further down you say that i
can do the same for check boxes. For what i would like to do it seems like
it might be a lot coding. So pseudo code style:

if checkboxA = True
'Use append query to insert CompanyID and CategoryID into
tblCompanyInvolvements
elseif checkboxA = False
'Use delete query to remove CompanyID and Category from
tblCompanyInvolvements

This coding would be placed in the AfterUpdate section for each checkbox, of
course changing the name of the checkbox to mirror the correct name. Is this
correct?

Al Campagna said:
J,
Do you mean that if chkXYZ is True you want Involvement to be set to "XYZ", and
chkABC
would set Involvement to "ABC"?
I'd use an OptionGroup where only 1 involvement could be checked.
Set chkXYZ OptionValue to 1, chkABC to 2, etc..
On the AfterUpdate of the OptionGroup (ex. name optInvolvement)
If chkInvolvement = 1 Then
Me.[Involvement] = "XYZ"
ElseIf chkInvolvement = 2 Then
Me.[Involvement] = "ABC"
etc....
End If
(you could use a SelectCase instead of IF)

The advantage of an OptionGroup is... only one choice allowed, and only one
AfterUpdate to code.
The procedure would be the same if you used separate check boxes... coding each
checkbox for it appropriate Involvement value.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

JKarchner said:
I have created a table called tblCompanyInvolvments. It has fields that are
CompanyID, CategoryID, and Involvement. Involvement is a Yes/no field. I
would like to create a form that shows all the categories as text labels with
a check box next to it, and when a check box is ticked it will automatically
add that record to the table. The amount of categories will never change,
and i would like to have this type of set up because it mirrors other
software that my company is currently using. This would make it easier on
end uesrs to also use this software. Thank you very much for any help you
can provide.
 
Back
Top