422,911 Members | 1,775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,911 IT Pros & Developers. It's quick & easy.

How to clear the buttons on a form in Access

P: 5
Dear All, thank you for reading!

I have made a form which contains a lot of buttons for ease of data input for the end user.

All the buttons stay high-lighted after moving on to the next record.

The only way I have found to solve this is to close the form and reopen it.

Is there a way to reset the form or is there code I could write that could open and close the form in one click?

I was hoping to make a button that goes to next record and clears the form. That would be the perfect scenario.

I am new to Access so I have read other posts about this but I have not been able to make my form work with their examples. Like the words clear, but the buttons won't reset.

This is the last step to making my form usable so I hope someone can help me!

Thanks,

Rachel
Apr 23 '18 #1
Share this Question
Share on Google+
10 Replies


twinnyfo
Expert Mod 100+
P: 2,420
Hi Rachel!

Welcome to Bytes!

Could you please clarify for us what you mean by "clearing" buttons or "resetting" buttons?

I think before we can help you, we need to have the same terminology.

Thanks for the assistance.
Apr 23 '18 #2

NeoPa
Expert Mod 15k+
P: 30,848
Hi Rachel.

I'm sure we'll be able to help you, but I for one have little understanding of what you're trying to explain.
ArkWent2Sea:
All the buttons stay high-lighted after moving on to the next record.
I was hoping to make a button that goes to next record and clears the form.
What do these sentences mean? Without context it's hard to know what you're asking about.

Why do you have a bunch of buttons on the form in the first place? What type of Form are you working with? Is it a simple Add/Edit/Delete Form? Is it in Continuous Form mode?

Please try to answer all questions posed. Number them if you like.
Apr 24 '18 #3

P: 5
Dear All,

Thank you for your responses!

I have attached photos for better understanding. The form is to be used for my team to record the status of equipment we own.

When I created the form I used the option "button" in controls to create a way of inputting data into my form with just one click.

When you see image "buttons before click" you can see the buttons are the blue rectangles (when clicked they place a word in my form which reflects the status of the equipment)

On image "buttons after click" you can see that the blue buttons have been hilighted into a darker blue to signify being selected.

On image "buttons after next record" you can see that the text has cleared to allow for a new record but the buttons have not reverted to their "unselected" colour of light blue.

This is confusing for the end user. What I would like is for when the form goes to next record, all the buttons change to their default light blue unselected colour.

The only way I can make that happen is by opening and closing the form for every record. Can one make a macro that does that? Or is there a better way to do this?

Kind Regards,

Thank you for all your assistance!

Rachel



Attached Images
File Type: jpg Buttons after click.jpg (36.8 KB, 231 views)
File Type: jpg Buttons after next record.jpg (37.2 KB, 223 views)
File Type: jpg Buttons before click.jpg (36.6 KB, 225 views)
Apr 24 '18 #4

P: 5
Oh and in Response to you NeoPa, I don't know what continuous form mode is, or and add / edit / delete form is. I am happy to share the document with anyone who would find it useful.

When I mean button, when you create a form, in "Controls" one of the options is "button" and it is a interactive place you can click and it can do a variety of commands depending on what macro or code you attach to it. Please see attached photo to where I found it in access.

Kind Regards

Attached Images
File Type: jpg what do i mean by button.jpg (34.9 KB, 232 views)
Apr 24 '18 #5

twinnyfo
Expert Mod 100+
P: 2,420
Rachel,

If I understand your intent, based upon your description, after you click one of the buttons in the option group, when you go to the next record, you want the option group buttons to reset, as if nothing had been clicked, correct?

If your option group has been properly configured and it is bound to one of the fields in the underlying recordset, this should be automatic. For example, let's say we had a table holding survey results and each record was a survey question. The answers are from 0-5, with 0 indicating "Not Scored"--and this is the default value for that scoring field. If you have your option group bound to that field, every new record it encounters will default to the button with the option value of 0 (which will look like it has been pressed). When you click on any of the other option buttons, based upon the option value of those buttons, the value of the underlying field will be updated to that value. Move to the next record (a new record) and the 0 button looks pressed. Go back to the previous record, and the score you entered should be pressed. This requires no VBA coding whatsoever.

The only thing I can think as that this is not how you have your form/option group constructed.

It would be helpful, also, if you shared any VBA that was associated with these option buttons.

Please let us know.
Apr 24 '18 #6

P: 5
Dear TwinnyFo

Apologies for the delay I have been sick.

SOooooo. I have never altered the colours at all, they were just the default settings made by access. When I go into the buttons properties it shows this screen showing what the colour is when the button is pressed and when it is not pressed.

The only code I have linked to the button I will share below, it's function is just to input a word into my table when clicked.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Frame135_AfterUpdate()
  2.    Select Case Frame135.Value
  3.       Case 1
  4.          Internal_CheckForDamage.Value = "Good"
  5.       Case 2
  6.          Internal_CheckForDamage.Value = "Issue"
  7.  
  8.          End Select
  9. End Sub
I guess I need a way to "unclick" the button after the "next record" has been selected.

Any ideas?

Kindest Regards,

Rachel

Attached Images
File Type: jpg How the buttons are coloured.jpg (113.9 KB, 99 views)
May 15 '18 #7

twinnyfo
Expert Mod 100+
P: 2,420
Rachel,

It is clear from your last post that one of two things is true: 1) You do not have your Option Group properly configured as described previously or 2) you are not using an option group at all. When using an option group, there is never a need to “unclick” or “reset” a command button when it goes to a new record. The option group assumes the underlying value of the field it is bound to and sets the buttons accordingly.

Perhaps you need to start fresh with a new option group, assigning the specific values you want and binding it to the field you desire.

Although you can use the value to the option group itself in your VBA (as you are showing) there should be no need to in this particular case.
May 15 '18 #8

P: 5
Dear All,

I found a solution.

I made a reset button and added this code to it:

me.Frame[frame number]= Null

the frame referenced the frame surrounding the button.

Now when I go to next record, I also click reset and the buttons go back to their un clicked colour.

Thanks for your help anyway.

Kind Regards,

Rachel
May 16 '18 #9

twinnyfo
Expert Mod 100+
P: 2,420
Rachel,
Although I am glad that you have found a working solution, I am a bit diasappointed that you haven’t really learned anything. If you properly create an option group there should be no need for a Reset Button. Each record will reset the option group. This is a standard method for doing what you are trying to do. However, if you are satisfied with your solution, then that is all that really matters.

Kind regards and I wish you success.
May 16 '18 #10

NeoPa
Expert Mod 15k+
P: 30,848
I have to agree with TwinnyFo here. It's frustrating to see members end up with a roundabout, sort of, solution when the appropriate and logical solution has been posted already. However, I do understand also that things that are straightforward to many of us can still seem totally weird and obscure to others.

At the end of the day at least we can be happy that you have what you need, for now at least.
May 16 '18 #11

Post your reply

Sign in to post your reply or Sign up for a free account.