Access 2010 Cycle Property Syntax

Hi Experts,
I have a Frame that contains two Radio Buttons to switch the Form Cycle Property between One and All Records however I can't get the syntax correct.
I would expect that when I click on the Radio Button it would change the Property to the desired value but it doesn't work.  i.e. Nothing happens.

What is the correct syntax?  The current code is below.

Private Sub OptCycleRecordsAll_KeyPress(KeyAscii As Integer)
Dim F41010_001 As Form
Set F41010_001 = [F-41-010 - Event Group Maintenance Form - Maxi Data]
F41010_001!FrameFormCycleOption.Cycle = 0
End Sub

Private Sub OptCycleRecordsOne_KeyPress(KeyAscii As Integer)
Dim F41010_001 As Form
Set F41010_001 = [F-41-010 - Event Group Maintenance Form - Maxi Data]
F41010_001!FrameFormCycleOption.Cycle = 1
End Sub

Thanks.
Bob C.
Bob CollisonSystem ArchitectAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
If I understand what you are trying to do, you should not need code to change the value of the frame.

When you use a frame and option buttons, you should start by adding the frame to your form.  Then size it and bind it to the field in the forms recordsource that you want it bound to (if any).

Then, click on the radio button in the ribbon and when you place your mouse over the frame, the frame should turn black until you drop the button inside the frame.  Do this for both of the radio buttons.  Then set the value of each of the radio buttons.

When you view your form in form view and click one of the radio buttons, it will change the value of the frame.
Bob CollisonSystem ArchitectAuthor Commented:
Hi Dale,
 Basically I have done what you have suggested as the User Interface to the code I supplied.  The code I supplied is what I have done that you refer to as 'set the value of each of the Radio Buttons'.  i.e. The code to set the Form Cycle Property.

My problem is getting the code to work.  Currently it doesn't do anything when I click on the Radio Button and there are no errors when it is executed.
Thanks.  
Bob C.
Dale FyeOwner, Developing Solutions LLCCommented:
Ok,  Let me make sure I understand.  You want to use this option group to allow you to change the forms Cycle property.  If you are doing that for the current form, then you would use the frames AfterUpdate event, something like:

Private Sub fra_YourFrameName_AfterUpdate

    me.Cycle = me.fra_YourFrameName

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Bob CollisonSystem ArchitectAuthor Commented:
Thanks Dale.

I have implemented it and it works perfectly.

Thanks again.
Bob C.
PatHartmanCommented:
When you use an option group, you refer to the frame control, NOT to the individual options within the frame.
Private Sub fraCycle_AfterUpdate
    Select case Me.fraCycle
        Case 0
            Me.Cycle = 0
        Case Else
            Me.Cycle = 1
    End Select
End Sub

Open in new window


This assumes that you used the cycle value as the value for the options in the frame.
Bob CollisonSystem ArchitectAuthor Commented:
Hi Dale,

Thanks for the clarification.

Bob C.
Bob CollisonSystem ArchitectAuthor Commented:
Thanks Pat,

Sorry I didn't realize that it wasn't Dale.

Thanks for you clarification.
Bob C.
Dale FyeOwner, Developing Solutions LLCCommented:
Glad to help, Bob.

As always, Pat is great at providing more detailed explanations.  Thanks, Pat.
PatHartmanCommented:
Any time Dale:)  And Bob:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.