Share via

Option Buttons & After Update code

Anonymous
2012-02-28T08:22:16+00:00

In my Form of Access 2010, I have bound textboxes named; Current Reference (Text), Date, Amount (Currency)**, Rev 0 Reference (Text), Rev 0 Date (Date), Rev 0 Amount (Currency), Rev 1 Reference, Rev 1 Date, Rev 1 Amount, Rev 2 Reference, Rev 2 Date, Rev 2 Amount, Rev 3 Reference, Rev 3 Date, Rev 3 Amount, Rev 4 Reference, Rev 4 Date, Rev 4 Amount.

I also have unbounded option buttons named; R0, R1, R2, R3 & R4 with After Update code which written like the following:

______________________________________________________________

Private Sub Option R0_AfterUpdate()

Me. Rev 0 Reference = Me. Current Reference

Me. Rev 0 Date = Me. Date

Me. Rev 0 Amount = Me. Amount

End Sub

______________________________________________________________

Private Sub Option R1_AfterUpdate()

Me. Rev 1 Reference = Me. Current Reference

Me. Rev 1 Date = Me. Date

Me. Rev 1 Amount = Me. Amount

End Sub

______________________________________________________________

Private Sub Option R2_AfterUpdate()

Me. Rev 2 Reference = Me. Current Reference

Me. Rev 2 Date = Me. Date

Me. Rev 2 Amount = Me. Amount

End Sub                                                                                                                           

______________________________________________________________

ETC., ETC.,

The idea is if I click on 1 of the option buttons, the data from Current Reference*,* Date, and Amount will be copied to the respective textboxes so that I do not need to type again the same data. While in my report, only the Current Reference*,* Date, Amount will be shown and the rest are just for recording purposes. This has been achieved successfully.

The problems are:-

1.       Once I move to next record, the option button which earlier was selected, remain selected. In a case where I need to click on the same button for the current record, the details have been ‘overwrite’ or removed.

Question: What are the other solutions I could try to make the option button remain unchecked/not selected?

2.       I tried to copy the record to be pasted on a new fresh record. But Microsoft Visual Basic message pop-up showing “Run-time error ‘-2147352567 (80020009)’: Update or CancelUpdate without AddNew or Edit”.

Question: How to rectify this error?

Thank you.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-03-05T07:18:49+00:00

Just ignore my previous request.

I managed to solve it.

Juz replace AfterUpdate to Click & add a line to my current code; Me.Option1393.Value = 0

:))

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-03-01T08:29:48+00:00

    I have no idea how to code the current event of the form. Can you help me sample codes?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-02-29T05:37:11+00:00

    I would add a very small button to the form - call it something like cmdFocus.

    Make it transparent, but visible, put it in a corner out of the way, but where you can see it in design view.

    Code the current event of the form so that this button gets the focus when the form goes to the next record (instead of an option button).

    Something like:

    Me.cmdFocus.SetFocus

    Now as you move to the next record, none of the option buttons will be selected.

    See if that fixes the problem with the overwriting of values.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-02-29T04:03:16+00:00

    No, I have separate 5 option buttons and can select all at any time.

    Yes, The form work without errors to edit and add records even without clicking any of the option buttons.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-02-28T19:27:03+00:00

    Please explain a bit more about the option buttons.

    Do you have an option group with 5 buttons in it and you can only select one of the 5 options at any time?

    Does the form work without errors to edit and add records, if you use it without clicking any of the option buttons?

    Was this answer helpful?

    0 comments No comments