Sticky Pushbutton

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make pushbuttons take on the same value as the previous record when
advancing to a blank record?
 
On Fri, 20 Jan 2006 10:39:02 -0800, "Bob Paup" <Bob
How do I make pushbuttons take on the same value as the previous record when
advancing to a blank record?

Um?

Pushbuttons don't HAVE values.

What control is this?

You can set the DefaultValue property of a textbox, combo box, option
group, etc. in its AfterUpdate event:

Private Sub Controlname_AfterUpdate()
Me.controlname.DefaultValue = """" & Me.Controlname & """"
End Sub

John W. Vinson[MVP]
 
I'm sorry. It is based on a table such that the value in the table selects
the button in a button group. When entering data I want the button to remain
the same in the new record unless I change it.

Bob
 
I'm sorry. It is based on a table such that the value in the table selects
the button in a button group. When entering data I want the button to remain
the same in the new record unless I change it.

Then set the DefaultValue property of the Option Group control in that
control's AfterUpdate event.

John W. Vinson[MVP]
 
What do I set it equal to?

John Vinson said:
Then set the DefaultValue property of the Option Group control in that
control's AfterUpdate event.

John W. Vinson[MVP]
 
What do I set it equal to?

The value of the option group that you just selected.

I can't see your form, so I don't know what the name of the option
group might be. Let's say it's optMyGroup. Click the ... icon by the
AfterUpdate event in the control's Properties; select Code Builder;
and edit the code to

Private Sub optMyGroup_AfterUpdate()
Me.optMyGroup.DefaultValue = Me.optMyGroup
End Sub


John W. Vinson[MVP]
 
My option group is called "category" so I placed the following in the after
update properties of the option group:

Me.Category.DefaultValue = Me.Category.Value

I tried it with .value on the end and without it.

Nothing happens when I go to a new record. Don't I have to get the value
from the previous record of the field in "Input" which is the control which
the button is based on?
 
My option group is called "category" so I placed the following in the after
update properties of the option group:

Me.Category.DefaultValue = Me.Category.Value

Did you put this text directly in the AfterUpdate property line?

Or did you read and follow my previous suggestion, which explains the
correct method?
I tried it with .value on the end and without it.

That's the default property so it should make no difference.
Nothing happens when I go to a new record. Don't I have to get the value
from the previous record of the field in "Input" which is the control which
the button is based on?

I don't think so: you're setting the Default value *OF THE OPTION
GROUP CONTROL* on the form to whatever value it had the last time you
selected something from that control. Is the Name property of the
option group "Category" and its Control Source "Input"?? I'm not sure
where this "Input" is coming from!

If you want the default value to change each time you look at a
different record, to the value in that record, even if you don't touch
the option group buttons - put that line of code in the Event
Procedure for the Form's Current event (as well as the Category
control's AfterUpdate).

John W. Vinson[MVP]
 
Thank You. I had to place the code in the current event also, then it worked
as I expected

Bob
 
Back
Top