focus on a button, one at a time...

  • Thread starter Thread starter Lapchien
  • Start date Start date
L

Lapchien

I'd like to add an 'Admin' form to my db, just a plain and simple (!) form
with 7 buttons, each button just runs macro1, macro2, macro3 and so on.
But - I'd like each button to only have focus after the preceding button
has been pressed (and the macro run). I'd like to fire this form up from
the db's startup form, and allow only 2 or 3 users to be able to operate the
button which runs the admin form. Any help mucho appreciated.

Thanks,
Lap
 
I'd like each button to only have focus after the
preceding button has been pressed (and the macro run).

In the forms's Load event, you'll need to initialize the
sequence by telling the first button to execute the macro:

1) DoCmd.RunMacro "MacroName"
or you could use:
2) Call cmdButton1_Click
.. . . if you've set the macro to that button. The next
line assigns the focus to the next button:

Me.cmdButton2.SetFocus

Repeat this for each button in the series, assigning
control names as necessary.

In order to limit access the the form, you could use
Access security, or you could read their machine names and
hardcode them in or store them in a table. You can find
the code to do that at www.mvps.org under The Access Web.

Hope this helps some,
Crystal
 
Lap,

Set the Enabled property of all the command buttons to No.

To restrict access to the form, perhaps some sort of password entry
could be required, following which the first button is enabled. The
details of how to do this would depend on a number of factors, such as
whether it's just access to these buttons that you want to control, or
permission to open the form itself, and whether you would have
separate passwords for each of the 2 or 3 chosen ones, and whewther
the passwords would need to be changed periodically etc.

After that, you could enable the next button from the macro on the
previous button, e.g. use a SetValue action as the last action in
Macro1 to set the value of [Button2].[Enabled] to Yes, and so on.

- Steve Schapel, Microsoft Access MVP
 
Thanks, I'll give it a go.


--
Thanks,
Chris
(e-mail address removed)

Steve Schapel said:
Lap,

Set the Enabled property of all the command buttons to No.

To restrict access to the form, perhaps some sort of password entry
could be required, following which the first button is enabled. The
details of how to do this would depend on a number of factors, such as
whether it's just access to these buttons that you want to control, or
permission to open the form itself, and whether you would have
separate passwords for each of the 2 or 3 chosen ones, and whewther
the passwords would need to be changed periodically etc.

After that, you could enable the next button from the macro on the
previous button, e.g. use a SetValue action as the last action in
Macro1 to set the value of [Button2].[Enabled] to Yes, and so on.

- Steve Schapel, Microsoft Access MVP


I'd like to add an 'Admin' form to my db, just a plain and simple (!) form
with 7 buttons, each button just runs macro1, macro2, macro3 and so on.
But - I'd like each button to only have focus after the preceding button
has been pressed (and the macro run). I'd like to fire this form up from
the db's startup form, and allow only 2 or 3 users to be able to operate the
button which runs the admin form. Any help mucho appreciated.

Thanks,
Lap
 
Back
Top