Require pressing of button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a tabbed interface for my data input form. However, in order for it
to work properly, I need a button to be pressed that runs an append query.
I am wondering, is there a way to make sure that the user can't go to the
next tab before pressing the button?
I'm sure people will be intelligent enough to remember that they have to
press it, but if I could somehow make it mandatory, that would be even better.

Thank you.
 
You could make the next tab invisible, and have the click event of your
button make it visible after running the append query.
 
Niniel,

I'm not clear on at what point you require the button to be pushed. Is it
when the user clicks on a tab? If so, you could place a non-visible, unbound
control on the front page, and set its DefaultValue to False in design view.
In the code behind the button that runs the append query, add a line to set
its value to True:

Me![yourhiddentextbox] = True

Then you can use the OnClick event of the Page control. If the textbox'
value is True, do nothing, allowing the user to move to the page. If it is
False, you could display a message, but you might just want to run the
CommandButton code:

Call YourCommandButton

Hope that helps.
Sprinks
 
"Niniel" wrote:

My apologies; but I don't think my suggestion is a robust solution. You
would need to set the hidden textbox' value back to False for the next record
in the On Current event, but if you toggled back to the first record and
clicked on the tab, you would do a redundant append query.

MVPs might have a better idea, but my approach would be to add a boolean
field to the RecordSource underlying the form with a default value of False,
bind an invisible checkbox to it to prevent the user from changing it, and
set its value only in code.

Sprinks
 
Ok, here's some clarification then:

The user is supposed to enter some information on the first tab, then press
the button. The button will save the new record, run the query, and then take
the user to the second tab. From there on it doesn't really matter anymore if
he works through the remaining tabs in sequence.
If they don't press the button the next tabs will pretty much remain empty,
so they'll notice right away that something's amiss. What I'm trying to find
out is if I can prevent them from even going to another tab unless they press
the button.

Sprinks said:
Niniel,

I'm not clear on at what point you require the button to be pushed. Is it
when the user clicks on a tab? If so, you could place a non-visible, unbound
control on the front page, and set its DefaultValue to False in design view.
In the code behind the button that runs the append query, add a line to set
its value to True:

Me![yourhiddentextbox] = True

Then you can use the OnClick event of the Page control. If the textbox'
value is True, do nothing, allowing the user to move to the page. If it is
False, you could display a message, but you might just want to run the
CommandButton code:

Call YourCommandButton

Hope that helps.
Sprinks


Niniel said:
Hello,

I have a tabbed interface for my data input form. However, in order for it
to work properly, I need a button to be pressed that runs an append query.
I am wondering, is there a way to make sure that the user can't go to the
next tab before pressing the button?
I'm sure people will be intelligent enough to remember that they have to
press it, but if I could somehow make it mandatory, that would be even better.

Thank you.
 
Niniel,

I like Ted's solution; make them Visible on pressing the button. This
approach still has the problem of how to know when the button's been pressed.
If you move to the next record, the Tabs will be Visible unless you set them
to invisible in the OnCurrent event. If you do that, if the user moves back
to the previous record, from which the user has already pressed the button,
when the user presses the button, a redundant append will be done.

This leads me to having a boolean field that contains the state of whether
the insert has been performed or not. The OnCurrent event can then set the
Visible state of the pages depending on its value.

Sprinks
 
If they don't press the button the next tabs will pretty much remain
empty,
so they'll notice right away that something's amiss. What I'm trying to
find
out is if I can prevent them from even going to another tab unless they
press
the button.

Why not use the tab change event. So, if they click on the next tab, you run
the code?

I mean, why bother to nag the user when the computer can do this.....

Don't make them click a button, and THEN click on then next tab. Use the
event of the tab..and simply run the code....

I mean, you put a key in the car, turn it..and you want to car to ask you :
"do you want to start the car???"

how silly!!!

If the user has to press the tab to go to the next part..then have that tab
control run the code and you are done. No buttons, no prompts, no training
of the users.
 
Albert,

I agree, Albert, however it seems that some precaution must be taken to
avoid inserting redundant records on subsequent events.

Other than adding a boolean field to store the status of "Records Inserted",
do you see any other way to control this?

Sprinks
 
Sprinks said:
Albert,

I agree, Albert, however it seems that some precaution must be taken to
avoid inserting redundant records on subsequent events.

You mean like hoping that the user will not press the button two times? How
were/are you planning to deal with this now?

I mean, if you can solve the above problem, then you don't have a problem
....do you?

Other than adding a boolean field to store the status of "Records
Inserted",
do you see any other way to control this?

Not really, but how were you planning to prevent the user from pressing that
button more then once now? If you setup something to prevent the user from
pressing the button more then once, then you can STILL GO WITH the
suggestion to get rid of the button, get rid of the screen space needed for
the button, get rid of the training of users, get rid of the nag prompts for
the user.....

I mean, the instantly you come up with a solution to solve the user from
pressing the button more then once, that is the VERY SAME instant you come
up with a solution to use the tab event to run that code only once.....

So, sure, we can work on a solution to prevent the code from being run more
then once, but that solution does not effect the issue that you can make
this happen automatic anyway....

Sure, a boolean field sounds ok.
 
Albert,

Yes, why not use the Tab change event... To save people from the effort of
having to scroll up again.
In order to complete page 1 of my form, they have to scroll down a bit, and
once they are there, they might as well press that button, right?

When they press the button, they will be taken directly to page 2, without
any "nagging". I thought I had already said that much.

Otherwise your suggestion seems like a very good idea, I certainly hadn't
thought of it. Thank you.
 
Yes, that's what I ended up doing. Works great.

Thank you very much for all the help!
 
Oh, and Sprinks, with regards to preventing duplicate entries - instead of
using your truly secure method, I cheated and made the button invisible after
it's been pressed. It'll only be made visible again if the user clicks on
another button on the last tab that starts a new record.
Invisibility is great! :)
 

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

Back
Top