Format button Visible in Continuous Form

  • Thread starter Chris Stewart via AccessMonster.com
  • Start date
C

Chris Stewart via AccessMonster.com

Hello,

I am trying to figure if & how to show a button on a continuous form based
on the value of a different field.

I have a form that contains SSN, Name, and Archive (0 or -1)

I want a button (cmdArchive) to be visible "if" me.archive=0 and .visible =
False if me.archive = -1

Seems easy, but I have not been able to figure it out. I seem to get it
based on just the first record within the form, but not the next, next and
so on.

Any help would be great!!

Thanks,
Chris
 
J

James Franklin

Chris,

You need to put something in the current event for the form, as follows:

cmdArchive.Visible = not me!Archive

Bear in mind that your button should be in the Header or Footer section of
the form. If you put it in the details section, an instance of the button
will appear for every record in the form's recordset. All the buttons are
then visible or not, depending on the current record.

As far as I know, there is no easy way of having the button on every record,
visible or invisible according to your archive setting.

Hope this helps!
Jim F.
 
K

Ken Snell [MVP]

A button on a continuous forms view (when put in the Detail section) exists
just once, even though you see multiple copies. Thus, its visible property
will be dependent upon the record that is "active" at that moment. Thus, if
the button should be visible when you're viewing the first record, it'll be
visible for all records on the form. If it's supposed to be invisible for
the current record, it'll be invisible for all records.

Other than the disconcerting visual effect of the button
appearing/disappearing as you move from record to record, this setup does
work ok. In similar setups on my applications, I use the Current event of
the form to set the visible or enabled property of a button fairly
regularly.
 
C

Chris Stewart via AccessMonster.com

Thanks for the help from Both of you! I have been reading more about this.
It seems that "maybe" going with a TextBox and setting the On_click might
be easier!

I just basically need 2 buttons (or text boxes) 1 = txtArchive, 2 =
txtUnarchive.

I am converting our Intranet web site over to Access.adp and SQL. In our
web asp page we have a datagrid that is populated and based on the
Archive.value the different link shows up. I have been tasked with making
our "new" front-end as close to the old way as possible.. :(

Any ideas how to use 2 textboxes to perform this idea? I have managed to
muttle through the example of the continuous form on Lebans.com, but can't
figure out how to make it work with 2 boxes (one on top of the other)

Thanks,
Chris
 
K

Ken Snell [MVP]

I'm not following you with regard to the "two textboxes" concept. Are you
wanting to go that way so that you can use Conditional Formatting? Or for
some other purpose?
 
C

Chris Stewart via AccessMonster.com

Yes mainly for the Format. Since I can't get a button to show up for each
record, then I can get the textbox to show up.

I have it working, so far. I just need to figure out how to send to back
and bring to front. I am looking for the code to accomplish that and poof
I am done..! Well with this "little" part..
 
K

Ken Snell [MVP]

You don't send to back or front. Just set focus on the textbox to make it
"the front one"; or use the Visible property of the textbox.
 

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