Solved

ACCESS VBA: Transfer value of radio button on form to table field

Posted on 2006-11-25
6
1,705 Views
Last Modified: 2007-12-19
Hi,

I have an option group on a form that has 3 radio buttons, each with a different value.
I am trying to send the actual value of the radio buttons to a field in a table when the user selects a radio button.
The value could be an assigned value since they don't change.

What would be the code in VBA that could do that?

Any ideas? thanks for your help.

MC
0
Comment
Question by:MonteCristo33
  • 2
  • 2
  • 2
6 Comments
 
LVL 27

Expert Comment

by:jjafferr
ID: 18012075

Assuming the Group is called Group1, and each of these buttons have a value, assuming 1,2 and 3

"On Click" [Event Procedure] of Group1 have this code:

if Group1=1 then
 xyz="button one"
if Group1=2 then
 xyz="button two"
else
 xyz="button three"
end if

you should place the same code "On Load" of the Form too.

jaffer
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 18012085
xyz is your control on the Form, which is bound to the field in the Table,

sorry, for the "On Load" the code should be the other way around:


if xyz="button one" then
 Group1=1
if xyz="button two" then
 Group1=2
else
 Group1=3
end if
0
 
LVL 18

Accepted Solution

by:
p912s earned 125 total points
ID: 18012092
Is the form that the radio button is on linked to the table that will store the value? If it is then set the Control Source for the Frame/Option Grooup to the field that should store the value.

Hope that helps.

Scot


0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:MonteCristo33
ID: 18013948
Hi Scot,

the best solutions are always the simplest ones. It works like a charm, thank you very much for your help.

MC
0
 

Author Comment

by:MonteCristo33
ID: 18013957
Hi Jaffer,

Thank you very much for your contribution. I was already using a similar Case statement based on my option group to enable/disable textboxes. My real difficulty was updating the corresponding field in the linked table, which Scot helped resolve.

As I am working on several projects at the moment, no doubt your knowledge will come in handy at some point.

Thanks again for taking the time to help.

MC
0
 
LVL 18

Expert Comment

by:p912s
ID: 18014341
MC,

You're most welcome, glad to help. And thanks for the points and grade.

Scot
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Display multiple images in report 12 85
Access Delimiter for check box filter 3 14
DATETIMEOFFSET feature 1 5
SQL Query 2 0
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now