Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tabbing through fields on a "tabctrl" 1

Status
Not open for further replies.

dotolee

Technical User
Jan 27, 2008
134
CA
Hi. I need a way to "prevent" a SAVE from occurring when my users tab through any page on a tab control i've created. What's happening is that I've set up the tab order so that it'll move them through each page of the tab control. But if they hit the tab key at the end of any given page on the tab control, it saves the record, which in my case, because of different logic running in the background, takes up a few seconds. How can i prevent the save from being run? I want the save to occur only when the user explicitly navigates away from the current record. I checked the tab order and can't see anything too obvious.
Thanks.
 
Can you capture the keystroke and change it to vbCancel under certain conditions in the tab events?

"Rome did not create a great empire by having meetings, they did it by killing all those who opposed them."
 
How are ya dotolee . . .

Since its next to [blue]impossible to tell[/blue] if a user intended to save a record or not, when transitioning from one tab to another, present th user with a MsgBox, [blue]giving the option to save or bypass![/blue]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I like your idea TheAceMan1. WOuld i do this in the "BeforeUpdate" method/event of the form?
 
dotolee . . .

Yes you could use the forms [blue]BeforeUpdate[/blue] event, however you'd get the message on any edited record. This could become a pain.

Your indications are that subforms reside on each tab. Is this true?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
one huge table is split up among many different tabs on my tab control.
as far as edits go... i think we've got them trained so that they find the record they want, click on the tab they're interested, change the field and then navigate away from the record to save.
the only real issue is when they first create the records. There are many fields to fill in and the end user is under pressure to finish quickly as someone is sitting in front of them waiting... so they generally tab through everything.
 
dotolee . . .

Your latest post should've been your first, or a part there of. Very informative.

Thru the user interface, a record isn't saved until the last control in the [blue]Tab Order[/blue] is parsed thru (Tab/Enter)!

If you set the Tab Index of the last control on the last tab to the highest, then the user can parse thru to the end. At the end, the forms [blue]Before Update[/blue] event checks if the record is new and pops the question.
Code:
[blue]   Dim Msg As String, Style As Integer, Title As String, DL As String
   
   If Me.NewRecord Then
      Msg = "Save The New Record?"
      Style = vbQuestion + vbYesNo
      Title = "User Response Required! . . ."
      If MsgBox(Msg, Style, Title) = vbNo Then Cancel = True
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
TheAceMan1

Thanks once again for your help! Sorry for not posting the right info from the start.

I tried reviewing the tab order on the various "tabs" on my tab control and only the controls on each tab appear in the list. If I'm understanding your recommended solution, I should see all controls on the form in the Tab Order list...
is this correct?
 
dotolee . . .

I forgot the difference when using the Tab Control. Just be sure the sequence from control to control ona any tab is as you desire . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I've reviewed them and the controls are in order... but there is no way for me to prevent the "save" from being triggered until they get to the end of the last tab from what I can see...
 
dotolee . . .

Are you saying: [blue]when you transition from one tab to the next thru your code, the record is saved at that point despite no save in code from you?[/blue]

Post the code for one of your tab transitions! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi again.

Yes, you've accurately described my problem. But I actually don't have any code for the event that triggers as they move through tabs.
I've only coded against the form's events, like Before_Update and After_Update.
?
 
dotolee . . .

Your saving because the tab control goes to the next record whenever you tab/enter thru the last control on any page. I setup a sumulation to check this out but I'm at work. I'll get to ya a soon as possible . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
ok thanks! whenever you can.
i REALLY appreciate your help!
 
dotolee . . .

My testing revealed the same results you've already quoted. I was quite surprised (although I've always used subforms instead of textboxes.) Botton line . . . [purple]there's no way out of prematurely saving a record.[/purple]

The only work around I see possible is to [blue]convert to unbound controls[/blue], performing a save thru VBA on the last control. This will restore full navigation to the tab control without premature saving.

[blue]Your Thoughts? . . .[/blue] wish I had better news [sad]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
hmmm... i'm not in the office right now so i can't play around but... if i do convert to unbound controls... that means that the form will no longer display previously submitted records... right?
I'll try to play around to see what happens.
Thanks!
 
dotolee . . .

Yesterday evening I tested with A2k. This mourning I tested with 2003. 2003 is not saving as in 2000! I'm looking into this further . . . as this may be version specific.

BTW: What version are you using?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Have you tried changing the cycle property to cycle current record?

Ian Mayor (UK)
Program Error
Your lack of planning is not my emergency!
 
ProgramError, TheAceMan1 ,
i'll be back at this client's office tomorrow... will look into both of your comments then.
thanks again for offering your help.

cheers.
 
Howdy ProgramError . . .

It never crossed my mind! [surprise], but it sure takes care of the problem. Have it in my library but never bothered to look! Worth a [fuchsia]pinky[/fuchsia] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top