VBA Code in Access w/ option buttons

I have created 2 option buttons in Ms Access 2007, on a blank form. The scenario is: I have a database with different events, and each event has there own ID. What I need to do is when I click one option button and hit a command button, it then exports that file into excel based on the eventID from the option button that I selected.

Can anyone give me a hand on this?

Its really important, that I get this answered. Its for my job

Sponsored Links:

Related Topics

Hiding option buttons based on other option buttons
I'm making a report in Access 2003. I have one sent of option buttons named workingorder and another set named compcondition. When option 1 and 3 are selected in workingorder, I would like compcondition to be hidden. When option 2 is selected, I need to see compcondition.

I have limited experience with code so hopfully it's just an easy fix that I'm missing. My code in the On Open event for the report is:

Private Sub Report_Open(Cancel As Integer) If Me.fmeLMASWorkingOrder = 2 Then Me.fmeLMASCompCondition.Visible = True Else Me.fmeLMASCompCondition = False End Sub

It tells me I have an expression that has no value and highlights "If Me.fmeLMASWorkingOrder = 2 Then"

I've tried a couple different ways can can't get this to work


Option Group Reference In VBA
I have an option group on my form comprised of eight check boxes. How do I refer to the individual check boxes of the group in VBA?

The option group frame is frame27, the first buttons name is check30.

Lastly, to indicate check30s state when checked do I use true/false or the option value in its property sheet


Using an Option Group to Filter a Microsoft Access Form
You can use an option group on a Microsoft Access form, report, or data access page to display a limited set of alternatives.
An option group makes selecting a value easy because you can just click the value that you want.
Only one option in an option group can be selected at a time.
In a form or report, an option group consists of a group frame and a set of check boxes, option buttons, and toggle buttons.


Querying a database with optuion buttons
I am trying to query a few tables by the use of a combo box and a set of three option buttons. The form will search my tables using the value in the combo box and selected option. The problem I am having is with the option buttons and knowing how to query my tables using them.

My problem is the option buttons don't refer to a single record. for example: the first option will be current which I want to select "active" and "possible" in out of one of my tables. The second option button "Cleared" will select only "Cleared" from the table and lastly the option "All" will select all records.


Access Crashing
Has anyone else seen this type of issue

I have a form with several buttons that call functions, one to run a VBA module, the other performs some VBA then opens a form.

Yesterday they all worked fine - today very time they are clicked they crash access.

Now here is the weirdest bit - if I put a debug stop in the code in the On_Click event of the buttons access does not crash!

Has anyone seen this before and is so how have you fixed it


Display Yes/No values by using check boxes, option buttons, and toggle buttons
In Microsoft Office Access 2007, a Yes/No field stores only two values: Yes or No. If you use a text box to display a Yes/No field, the value displays as -1 for Yes and 0 for No. These values are not very meaningful for most users, so Office Access 2007 provides check boxes, option buttons, and toggle buttons that you can use to display and enter Yes/No values. These controls provide a graphic representation of the Yes/No value that is both easy to use and easy to read.
This article describes the applications for each of these controls, and tells you how to add them to your forms and reports.
What do you want to do?
* Decide which control to use
* Create a bound check box, option button, or toggle button
* Create an unbound check box, option button, or toggle button
* Understand option groups
* Create an option group
* Add a new option to an existing option group


VBA Code for buttons, Access 2010
In using this new version of Access, I have found that when creating buttons, Access no longer uses vba codebehind to handle all the dirty work - rather, it seems Microsoft is forcing me to use the upgraded (and very nice I must say) Macro builder.

This is fine for all the simple tasks, but what I have myself into is a little more complex than the Macro builder is ready tohandle I think.

Before, when I created a button, not a Macro. I am trying to build the following button types:

Button 1 - Update a Field in a table, Save form, Close form
Button 2 - Update a field in a table, save form, new record
Button 3 - Update a field in a table, save form, print report, close form . and so on and so forth.

I used to put 3 or 4 buttons on the form, then copy and paste the generated vba in the correct order in a single button, and delete the dummy buttons. But now it seems as the basicfunctions are built using an embedded macro, and when that is combined with VBA, Access must choose between one or the other, rendering my button useless.

Is there a setting in 2010 that will change the way buttons are created in that VBA is used by default instead of macros?


Create Check Boxes/Option buttons/Option Group using VBA
Im really stuck on how to create: Check Boxes/Option button/Option Group in VBA.

Could someone help on either all of them or some of them please


Access 2007 option buttons
I have a form with five option buttons on it. I have five fields in the main table, ME1, ME2, ME3, ME4, and MS5. I have two issues:

1. I am having difficulty getting the group of option buttons to allow one and only one to be selected.

2. If the ME1 button is selected, that field in the table will be populated, if ME2 is selected the ME2 field should be populated, etc, for each record.


Access Help, Tips and Tutorials
If you are finding that you are getting unexplained errors with your applications as you develop or you have noticed that it seems to be running slower then it may be time to use the rarely mentioned decompile option on your application. When you compile VBA code various pieces of old code often get left behind. Decompile is a relatively unknown Access feature than can help drastically reduce the size of front end databases and also reduce bloating and decrease start-up times is the /decompile option. The /decompile command line option cleans out these bits of code and allows for a fresh start.


Option Group and Radio buttons
I added an option group and gave it to Label Names from the Option Group Wizard. It names the Frame105 and Radio Buttons Option89 and Option 91

I can't figure out how to test to see which one is selected.


Working with Radio Buttons and Option Groups
I am working on a database that has several radio buttons in a group option. When the start up form loads the first button is automatically selected, not by choice I have intentionally I left the default field blank in the properties because I want the user to select what option the want. Is there any way to uncheck all radio buttons when the form loads or opens up or does at least one button needs to be checked at all times


If Statements with user entry too
I have 2 groups of option buttons. One has 4 buttons and the other 2. What I am trying to do it populate one of the 2group option buttons when a particular option from the 4group is chosen. I also need to be able to independently chose either of the 2group options. IE if it is a hazardous waste, than the "Hazardous Material" group has the "yes" option selected. IF it is a different waste, the "Hazardous Material" will be what ever the user chooses.
This is what I have so far:

Private Sub Waste_Group_AfterUpdate() If Me.Waste_Type = 2 Then Me.Haz_Mat = Yes


Where to see the VBA code behind the form ?
Many years ago when I last used Access, I could see the code behind a form, where I could see the code behind the different buttons on the form and so on.

Where can I see this VBA code ?

I use Access 2007 now, if it matters.


Which type of Form layout is recommended?
I have been working on this project for this guy.

One of the forms I'm working on is linked between three different tables. One option is to have buttons that can be clicked that will take you to different details of each prospect (thus opening up another form) and the other option is to use tabs to enter details of each prospect. Pictures below.

Option 1: The use of buttons. Another form will open up with a click of a button. The button "Stats" at the bottom was clicked and opened up the formStat.

Option 2: The use to tabs. No form opens up with each click. The form is unprintable however, since tabs are being used.

Which option would you recommend or do you prefer? Buttons or tabs.


options group radio buttons
I have used the option groups wizard to create an option group with radio buttons. The list of buttons is defined by me. I have assigned to put pf the options group to a field. I would really rather have the text associated with the radio button in the field rather than a value. So I wohld prefer Small, Medium or Large in the field rather than 1,2 or 3. I do like the radio buttons for speed of data input over a combo box. How can I accomplish this


Empty values in a form option group
I have a form with an option group containing 6 option buttons.

I want to use the form's Before Update event to check for empty values in the option group and alert the user with a message.

The problem is that after the message is displayed and the user make the correction and then tries to leave the form or go to another tabbed page on the form, the code again brings the message up again so the option group value is still empty. I have tried to use the refresh and update method to no avail.

I am using Access 2007 and running Windows 7 and this is the code.

Private Sub Form_Beforeupdate(cancel As Integer)

If IsEmpty(GRPFIP) Then
MsgBox "You have not answered all of the questions", , conAppName
cancel = True
Exit Sub
End If


frame option stored values
Can a frame with two option buttons store YES/NO instead of 1/2?

I need to show the value of a field controlled by two option buttons in one single frame in a listbox and I need it to show up as yes/no instead of 1/2


Option button value
I have created my option buttons and they're in a nice group and all, but I can't figure out how to read the values I choose there. Every single Access help page only tells how to create the buttons.

Anyhow, the purpose is selecting how to deal with duplicate records on creation. I have four options. The form is named popSaveOptions and the frame is SaveOptions. Can anyone give mesteps to getting back the user selection value?


how to use or run access vba code in access 2007?
We press alt+f11 then insert >> module. To run that, view >> macro >> runmacro >> refreshpt something.

similarly in access I wonder how to run vba codes. there is one option called vba in database menu in (access 2007). I clicked that and inserted modules and saved. Now I don't know how to run it in a table or query.