command button caption on continuous form

D

Dhonan

I would like the caption on the command button to change based on the content
of the individual record on each line of a continuous form.

For example, if the first record is transaction type "123" then the caption
of the button should read - "UPdate 123 transaction".

If the trans type is "456" then it should read "display report for 456."

I have tried to use the "on current" event, but it changes every button on
the continuos form to what record has focus.

Thanks for your help
 
F

fredg

I would like the caption on the command button to change based on the content
of the individual record on each line of a continuous form.

For example, if the first record is transaction type "123" then the caption
of the button should read - "UPdate 123 transaction".

If the trans type is "456" then it should read "display report for 456."

I have tried to use the "on current" event, but it changes every button on
the continuos form to what record has focus.

Thanks for your help

The behavior you have is correct for a form in Continuous View.
A continuous form is basically one record, repeated one under the
other. You cannot have a command button (which is not bound to any
field) on each record with a different caption.

Place one Command Button in the form header or footer.
Then you can code the Form's Current event:

If Me.[TransType] = 123 then
Me.CommandButtonName.Caption ="Update " & Me.[TransType] & "
transaction.
ElseIf
Me.[TransType] = 456 then
Me.CommandButtonName.Caption = "Display report for " & Me.[TransType]
Else
etc......
End If

Then code the command button's click event to run the correct code.
The above assumes the [TransType] value datatype is a Number datatype.
If it is a text datatype then surround the value with quotes, i.e.
"123".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top