Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

OptionButn group=>(single value in DB)

Posted on 1998-07-01
3
Medium Priority
?
135 Views
Last Modified: 2010-05-03
In Delphi it is possible to use a group of "radio buttons" (option buttons) to represent a single field in a DB.ie each button has an assigned value wich-when selected- is written to the specified field in the DB. Is this possible in VB5? seems to me that with the standard (ActiveX) component suplied with VB each button bust be bound to its own field? I could not find any documentation describing the methodology of binding option buttons to a DB in the manuals. Im using VB5(Enterprise Ed.)
0
Comment
Question by:Deep Diver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
swilt earned 300 total points
ID: 1464660
Set up your Data Control: DatabaseName and RecordSource
Set up a Label:DataSource, DataField and Visible = False

Use the following code (this could be modified to use a control array of option boxes)

Private Sub Label1_Change()
    Select Case UCase$(Label1.Caption)
    Case "X": Option1.Value = True
    Case "Y": Option2.Value = True
    Case "Z": Option3.Value = True
    End Select
End Sub

Private Sub Option1_Click()
    Label1.Caption = "X"
End Sub

Private Sub Option2_Click()
    Label1.Caption = "Y"
End Sub

Private Sub Option3_Click()
    Label1.Caption = "Z"
End Sub

0
 

Author Comment

by:Deep Diver
ID: 1464661
Hi "swilt"
Thats a very usefull trick. Thanks.
My only problem with this solution is that in my program there is about 50+ instances of this problem (I maybe should have said this in my question...sorry). However if nobody else have any comments/answers that uses less code I will award you the points.

Regards
Riaan
0
 

Author Comment

by:Deep Diver
ID: 1464662
Hi again!
I just tried out the Indexed version of your proposed answer; only 2 instructions!

I now realize that my previous comment was very much uninformed!
Here's your 100 points!

Regards
Riaan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question