How do i change the check box value in a form?

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

Guest

Say I have created a form. One of the headings read "Type of Damage" and I
have 2 optons to select for that. Option 1 - "Struck" and Option "Damage".

How do I format it:-

1. so some one can only select ONE of the options.
2. When selected, the word (eg. "Struck") is saved in my table instead of a
-1?

Thanks in advance.
 
Hi xneiax,

Use an Option Group with two Options - Struck and Damage. Use the wizard to
create the Option Group, with the option "I want to save the choice to use
later".

On your form, put a hidden text field for the item you are wanting to record
in your database, then have some code behind the On Click event for you
Option Group like this:

select case optgrpChoice
case 1
' Struck
me.txtDamageType = "Struck"

case 2
' Damage
me.txtDamageType = "Damage"

case else
' Shouldn't be able to get here
msgbox "not sure how we got here"

end select

Of course, I personally would question why you would want to record the text
in your database rather than creating a lookup list of Damage Types and
linking to that list, that way you can use a Combo Box for people to select
an item, and if you ever decide that "Struck" is now to be known as
"Impacted" you can just change it in the lookup table and that will fix it up
for all your records.

Hope this helps!!

Damian.
 
Thanks! I'll try the other alternative too.

Damian S said:
Hi xneiax,

Use an Option Group with two Options - Struck and Damage. Use the wizard to
create the Option Group, with the option "I want to save the choice to use
later".

On your form, put a hidden text field for the item you are wanting to record
in your database, then have some code behind the On Click event for you
Option Group like this:

select case optgrpChoice
case 1
' Struck
me.txtDamageType = "Struck"

case 2
' Damage
me.txtDamageType = "Damage"

case else
' Shouldn't be able to get here
msgbox "not sure how we got here"

end select

Of course, I personally would question why you would want to record the text
in your database rather than creating a lookup list of Damage Types and
linking to that list, that way you can use a Combo Box for people to select
an item, and if you ever decide that "Struck" is now to be known as
"Impacted" you can just change it in the lookup table and that will fix it up
for all your records.

Hope this helps!!

Damian.
 

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

Back
Top