Modules & VBA :: Disabling Option Group If A Button Is Pressed

Jun 16, 2014

I have an option group with 2 buttons in it, yes and no. It is set to default to No, but if someone hits Yes I want it to enable or turn on the next option group. Would just simply changing visible status disable it? Because I have a series of codes set up based on the second option group which read as:

Private Sub NumberOfAdditionalSites_Option1_GotFocus()
Me.AdditionalSitesLabel1.Visible = True
Me.AdditionalSitesText1.Visible = True
End Sub

[Code] .....

I do not want these to be visible if the initial option group is still set to no.

View Replies


Modules & VBA :: Cancel OnExit Event When Another Command Button Is Pressed

May 8, 2015

I have a form with a control for the user to enter some data and then two command buttons 'OK' and 'Cancel'

For the OnExit event in the control I have a procedure that check the user input and if incorrect, opens a message box with an error message asking the user to correct the data. It then cancels the event so the focus remains in the current control.

However if the user presses the 'Cancel' command button on the form to cancel & close the form, the OnExit event for the current control still fires and asks the user to correct the data.

In my code in the control, how can I recognise that the Cancel command button has been pressed, so I can cancel the OnExit event and close the form?

View 2 Replies View Related

Option Group: How To Store Selected Button?

Aug 25, 2005


On my form I have an option group with 4 radio buttons. Depending on the button selected certain fields become visible. This works all fine. Problem is though that I don't know how to store the selected value. At the moment, every time you open the form you have to select the same button to see the info stored in the fields that become visible. I guess that I'll have to somehow store the value for the selected buttons in the table. But How? Do I refer to the frame and store the value corresponding to the number of button (1, 2, 3 or 4) or do I store the balue for each button seperately?
I've played with it for too long now and cannot find the golden tip. Please advice.



View 5 Replies View Related

Forms :: Option Group With Command Button

May 31, 2015

I'm using option group with value 1 and value 2 with a command button to open two different forms. This is the code:

Private Sub Command9_Click()
Dim strForm As String
Select Case Me.Cornice0
Case Is = 1

[Code] ....

I would like to close form's option group once clicked the command button after the opening of the requested value form. I tried Docmd.close but all I get is the option group no more working.

View 4 Replies View Related

Forms :: Option Group - Warn User When Neither Of 2 In Option Group Not Ticked?

Jul 25, 2013

I stumbled upon the Option Group function just yesterday and, happy as a clam, I created a group with 2 options in radio button style. I assigned the values to a field called Registration_Type as the 2 options are "Confirmed Registrants" and "Prospective Attendees".

[Great. That part works well. When I look at the table, a 1 or a 2 is in that field so it's great to know how to control accidental ticking of radio buttons (previous 450 records or so didn't have this option group functionality so one might easily tick one of the buttons. So one part of controlling option group I know I can handle via the table itself for now.]

The challenge is how to ensure the user always ticks one or the other ... I went back to the main table and tested the 'required entry' option for the Registration_Type field but forcing an action like this is not ideal in my mind. The usual error message vagueness for the average user is no good and I don't want to limit the user so much.

Is there a way to simply have a popup come up warning that neither radio button was ticked? Perhaps something linked to the form - i.e., maybe "after update"?? I only learned about attaching code to before and after update on controls a couple of days ago, so not sure if this would be best approach.

Just something to let the user know that nothing has been ticked in the option group as that controls in which of 2 reports the data will show up in so any record not ticked might mean a registrant being left out, which would be rather disastrous <g>.

View 1 Replies View Related

Modules & VBA :: Option Group - IIF Date Return

May 2, 2014

I have a date field in a form fed by an option group. Most of the options return the correct values, but I'm having a hard time with this:

If the inspection date (in another form) is in Jan Feb or March, then return the date 1 Apr of the inspection year. If not, then return 1 Apr of the following year.

Here is the trouble line:

Case 2
IIf (Month([Forms]![FrmGeneralInspection]![txtInspectionDate]) <= 3), Me![txtReInspectionDate] = DateSerial(Year([Forms]![FrmGeneralInspection]![txtInspectionDate]) + 1, 4, 1), Me![txtReInspectionDate] = DateSerial(Year([Forms]![FrmGeneralInspection]![txtInspectionDate]) + 2, 4, 1)

View 4 Replies View Related

Create Check Boxes/Option Buttons/Option Group Using VBA

Mar 14, 2008

I’m 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?



View 2 Replies View Related

Blank Option (radio) Buttons In Option Group

Aug 18, 2006

I am using an Access database for a foreign language dictionary project.

One of the forms I use is populated by a query (qryLemmaTable) to retrieve information from tblLEMMA.

This form works precisely as I intend it to work, but there is a glitch on it that is driving me mad.

The form in question has an option group with 11 radio buttons that correspond to the parts of speech associated with each word in tblLEMMA.

When I click on the button optAdjective I apply a filter and the only records that are displayed are adjectives. (The same applies for Nouns, Verbs, Prepositions etc.)

Here is the glitch: even though the radio buttons apply the filter correctly, no “black spot” appears in the button. Other signals on the screen let me know what word type is selected, so I can accomplish what I want, but I want the “black spots” too!

Perhaps this will be a clue: For each radio button I use the following code in the GotFocus event.
Me.FilterOn = False
Me.Filter = "wordtype = 'A'" ‘(or N, etc)
Me.FilterOn = True

And this for the Lost Focus event
Me.FilterOn = False

Thanks for the help.

View 3 Replies View Related

Select Option Group Option Based On Checkbox Value

Aug 22, 2005


I've got an Option Group with 3 options; Yes, No and Future.

I also have a range of Check Boxes; 1 for every day of the week.

When one of the check boxes is selected I want the Option Group to change to Yes.

Currently, the Option Group defaults to Future and No will only be available by manually selecting it. This doesn't need to be changed.

Any help will be greatly appreciated!


View 2 Replies View Related

Forms :: How To Know If A Button Was Pressed At Beginning Of Field AfterUpdate

Aug 8, 2013

Here is my problem

In namefield_AfterUpdate, I check for duplicate name entries and notify the user if any are found - they are prompted as to whether the duplicate was accidental or intentional and continue working. This works fine for normal circumstances.

However, if the user updates namefield so that the value is a duplicate of an existing name in the database, but then presses Cancel (or Delete), then the namefield_AfterUpdate is fired and what button they pressed. The button Click code does not run first.

How can I tell if the user updated the name, but then realized they didn't want to save, and then clicked 'Cancel' (or any button) and the code should really skip the duplicate check validations/messages?

Running XP or Win7 with A2007

View 3 Replies View Related

Forms :: Button Back Color Change When Pressed

May 10, 2013

Is it possible that once the command button "Send Cost Request" in red is pressed it will change to green?

View 3 Replies View Related

Forms :: Record Is Written Only When Command Button Is Pressed

Sep 17, 2013

I have a form which displays some product details and a stock level. The subform below it allows entry of a quantity to issue and a control button to run a small macro, write a movement record to a stock movement table and then close the form. This works fine.

But the user can also cause the movement record to be written just by keying in a quantity and tabbing out. If this is done several times it writes several movement records and doesn't close the form. I want to ensure that record is only written when the command button is pressed.

Perhaps there is a more conventional or better way of achieving what I want but I can't think of it.

View 2 Replies View Related

General :: Empty Date Field Producing Error When Add Button Pressed

Aug 20, 2014

When user enter the data other than date field or when date field remain empty and user press the Add button, it is giving error.

(Error 3075)

Syntax Error in date in query expression '#'.

while same code is working for text field. but it is not working for date field.

If (Me.rdate) = "" Then

Exit Sub

End If

View 14 Replies View Related

General :: Restrict Records To Update Until Save Button Is Pressed On Form

Jul 16, 2012

How to restrict the updation of a record while entering until a save button is pressed on the form ???????? is it possible without the vba ?

View 10 Replies View Related

Forms :: Display Row Names And Blank Table Until Filter Button Is Pressed

Jan 7, 2015

So what I've basically got here is a form with 4 combo boxes and a button that when clicked will filter the results of a table (which is a subform/subreport) based on the values inside the combo boxes. So the problem I have is that when I open up the form it displays a fully filled table but I just want to display the row names and a blank table until the filter button is pressed.

View 2 Replies View Related

Modules & VBA :: Option Button To Filter Query On Form

May 14, 2014

how i would filter a form using an option button. E.g i want to be able to click an option button that is called Filter user and it will filter the query based on who is logged in? and a Filter all option that will clear the filter and show all records?

View 3 Replies View Related

Modules & VBA :: Insert Date If Letter T Is Pressed

Jul 17, 2015

On a form I have a textbox with a data type of Date/Time. If the user has the cursor in that text box and types the letter "t", I want to automatically insert today's date. I also want them to have the option of manually typing in a date, i.e. 05/12/2001 or use the Date Picker "calendar" item. This is using Access 2010.

View 3 Replies View Related

Disabling Command Button

Apr 14, 2005

Im new to this, and a beginner at database design, but I am currently stuck on disabling a command button.

Basically what happens is the form is loaded and there are two buttons (save and undo) both disabled:

Private Sub Form_Current()
Me!cmdSaveAddAd.Enabled = False
Me!cmdCancelAddNewAd.Enabled = False
End Sub

once a text box has been filled in the next occurance happens:

Private Sub Form_Dirty(Cancel As Integer)
Me!cmdCancelAddNewAd.Enabled = True
Me!cmdSaveAddAd.Enabled = True
End Sub

which enables both buttons. but the problem is when a user clicks the undo button i want both buttons to be disabled again, i cannot get the undo button disabled, the save button was easy enough:

Private Sub cmdCancelAddNewAd_Click()
DoCmd.RunCommand acCmdUndo
Me!cmdSaveAddAd.Enabled = False
End Sub

but if i put (Me!cmdCancelAddNewAd.Enabled = false) i get an error message saying 'you cannot disable a control that is in focus'.

View 1 Replies View Related

Disabling A Command Button

Sep 4, 2004

I'm designing a database to do invoices.

Items_sub is a continuous form.

For an item being returned I've made a command button that brings up a "return" form which is related to the Items form with a one-one relationship, (so the two primary keys are linked). Obviously an item can only be returned once, (logically and because of duplicate primary keys), so i'd like to disable the command button once it's been clicked. At the moment i have:

Private Sub cmdReturn_Click()
Me.cmdReturn.Enabled = False
End Sub

This doesn't work because it disables the button for all the records (It's in a continuous form).

Any help is greatly appreciated. Thanks in advance

View 4 Replies View Related

Disabling And Enabling A Button. PLEASE HELP, VERY IMPORTANT

Mar 14, 2007

Hi, I have a form called Product Details Display Form, which is for Product Details Display table. This form contains a button "Done" which saves everything into the table, or in other words, bounds the unbounded textboxes to the table. Basically, I want this button to be disabled at the begining, when the form loads, and when the user enters ALL the fields, it becomes enabled. Here is the code I have at the moment:
Private Sub Form_DataChange(ByVal Reason As Long)
If Me.Product_Brand = Null Or Me.Product_Code = Null Or Me.Product_Name = Null Or Me.List34 = Null Or Me.Price = Null Or Me.Details = Null Or Me.Discount = Null Or Me.Combo0 = Null Or Me.Combo2 = Null Then
Me.Command36.Enabled = False
Me.Command36.Enabled = True
End If
End Sub

I also have Me.Command36.Enabled = False in the Form-Load. I dont really know if it has to be in Private Sub Form_DataChange or not.

Please help me ASAP

Thanx in Advance

View 4 Replies View Related

Disabling The Close Button On A Form

Dec 21, 2006

I have a form which I want to disable the close button. On the properties of the form I set Close Button option to 'NO'. When I open the form the form close button is disable, but as soon as I maximse this screen, the close button becomes enabled again. Any Ideas as to why this is happening and how I can disable this button comlpetely on this form?

View 2 Replies View Related

Option Group

Mar 3, 2005

At present I have a form which is used to select a date range then using one of three buttons I can select one of three reports. I want to use an Option Group with three options to replace the three buttons. I have fiddled around using three separate Option Buttons and they work ok but in my opinion they are not the way to go. I need some assistance with the code as the Option Group is slightly different to the Option Buttons.

View 5 Replies View Related

Help Option Group

Jul 19, 2005

I have a very simple option group, status 1, 2 , 3 or 4. When the status of the group is changed i have the following code used to label txtStatusChangeAudit which lables who changed it based on the log in name. I have this code for each of the four options. The code works great but when i leave the form and come back to it the txtStatusChangeAudit that holds the code is now blank. When i click an option it again shows the information i want.

How do i get the form to save this information so when i leave the form and come back to it the last person to change the status will still be present?

Private Sub OpenOptionButton_GotFocus()
Me.StatusChangeAudit = "Status Open By; " & User.UserName & Space(1) & (Now)
End Sub

Thanks a million..


View 1 Replies View Related

Value Of Option Group

Jul 30, 2005

This should be an easy one.... I had an existing form. Needed a second form. But the two were so close I just added and option group to make certian fields visible when that option was picked. Now.... The problem is sorting or doing a query by the value of the option group. What I am thinking is I need to store the value of the option to a field. ie My option group is named "PickWO" the value is "1" or "2", so I added a field to my WO table... so how do I store the value of "1" or "2" to the new field? Hope this makes sense!

View 9 Replies View Related

Option Group

Dec 20, 2006

I have created an option group. There is a question and the response is yes, no or N/A. If the answer is no or N/A then I want to skip to the next question. If the answer is yes then I want to ask a follow up question. How would I make it so that when the answer is no or na and the user hits tab it would skip right over the follow up portion and move on to the next question?

View 1 Replies View Related

Option Group / Message Box

Aug 28, 2007


I have a option group with several buttons. Is it possible to apply a msgbox to one of the buttons where it will ask the user "Are you sure you want to generate report to excel". I would like the user click ok to continue or cancel. I am not sure how to get this message box prior to the code running when the option button is pressed. Thanks you for your time.

View 8 Replies View Related

Copyrights 2005-15, All rights reserved