Conditional button on subform

  • Thread starter Thread starter Trevor Briggs via AccessMonster.com
  • Start date Start date
T

Trevor Briggs via AccessMonster.com

I have a button on a subform that I want to make available only if certain
information has been entered.

I have been able to condition the button's Visible property, but no matter
which event I put it on it always affects the buttons on all the records on
the subform.

Is there a way to set this property differently for each subform record?

Thanks in advance,
Trevor Briggs
 
Trevor,

Simple answer to a simple question... No.

About the closest you could get is to replace the Command Button with a
Textbox, and format it so it looks similar to a command button. Then
you would be able to use Conditional Formatting to control its Enabled
property.
 
Thanks Steve

The principle seems to work. I have to put the conditioning in the OnClick
code, otherwise I have the same problem as with the button, no?

Also, how do I get text in the text box so it looks like a button? I tried
the "default text" property, but this doesn't show.

Thanks for your help,
Trevor
 
Trevor,

No, this won't work. You won't be able to do it in code. Any property
that you alter in code will apply to all records in the form. You need
to use Conditional Formatting, via the Format menu in form design.

As regards the appearance of the textbox, use the Special Effect
property - set it to Raised, and then adjust the Back Color, Font, etc
as required. You'll also probably want to set the Locked property to
Yes, and also use SetFocus code on the Enter event to move the focus
somewhere else, so you don't end up with a cursor in the "button" when
you click it.
 
I think I'm missing something - I don't see a Conditional Formatting
option. I'm using Access 97 - does it have this feature?

Also, I've got the "button" to look like a button using the Raised option -
but how do I get a label on it?

Many thanks,
Trevor
 
I think I'm missing something - I don't see a Conditional Formatting
option. I'm using Access 97 - does it have this feature?

No, that came in with A2000.
Also, I've got the "button" to look like a button using the Raised option -
but how do I get a label on it?

Set its Caption property.

John W. Vinson[MVP]
 
Trevor,

Ah, sorry for the bum steer. This feature was not available in Access
97. There is another way, but I will need to look it up... watch this
space!

To get the "label" you would enter what you want to show on the "button"
into the Control Source of the textbox, like this...
="The Lable"
 
Back
Top