Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Automatically Set Option Buttons

Automatically Set Option Buttons

Automatically Set Option Buttons

I (my employer) would like to automatically set two Optiotion Buttons based on a value of 1 or 2 in a database field.
How would I put this in code?
Where would it go?
This is my first solo project, and I would greatly appreciate the help.

RE: Automatically Set Option Buttons

If you are only storing an positive integer value (eg. 1 or 2) against a field you could do this:
On the form place a frame where you want the option buttons to go. Inside the frame create a crontrol array (Controls that have the same name and are differentiated by an index) of the option buttons. Ensure that you set the indexes that match the data field's max and min values. A good idea would be to start at 0.
When you parse the record from the recordset, just use the value of the field in the recordset as the index to the option control array and then sets its value to TRUE.
Control array of optArray option buttons.
rs = recordset coming from database.

To put the data back you would need to iterate the control array and check which index has its value = true and set that index number in the database.

Good Luck

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close