Solved

OptionButn group=>(single value in DB)

Posted on 1998-07-01
3
131 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 100 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

730 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