Command Button Caption on Continuous Form

  • Thread starter Thread starter Dhonan
  • Start date Start date
D

Dhonan

I have a continuos form with a command button that I would like the caption
of that command button to change depending on the transaction type of the
record.

For example, if the first record displayed is transaction type "123" then
the caption should be "display report for trans 123".

If the second record is transaction type "456", then the caption should read
"update trans 456".

I have tried using "on current", but that changes the caption on every
button on every line.

Any help would be appreciated it.

Thanks
 
I don't think that's possible in a continuous form. You could place the
button in the form's header or footer and run your code in the form's
Current event.
 
You may be right. The only way I have been able to partially do this is to
create a text box that has logic to display what I want the caption to say
and then place it over the top of the command button. Then sent the on-click
event for both the text box and command click to the same thing. But this is
a little clugy and the pointer doesn't display when the mouse is moved over
the text box (even though the click still works)
 
You could have multiple command buttons, each with different text.

Make then the same size and stack them on top of each other.

In the OnOpen() event diasble them

Me.MyCmdBtn1.Enabled=False
Me.MyCmdBtn1.Visible=False

And so on.

In the AfterUpdate of the Combo the user select the Trans type

You could then have a Case Select

Case1
Me.MyCmdBtn1.Enabled=True
Me.MyCmdBtn1.Visible=True

HTH
Mark.
 
Thanks - in my case though it is a little different. The trans type is not
selected by the user, but is already on file. I want the display to change
based on the transaction.

However, I do like your solution and will use it on other applications I am
sure.
 
Back
Top