Solved

After User Input have the cusor in the next field

Posted on 2014-12-24
19
171 Views
Last Modified: 2014-12-29
Merry Christmas...

I am working on a form and there are a lot of user inputs.  But everything I enter new data into a field the cusor goes back to the front of the record.  After each input I have it saving the record.....

Any help???
0
Comment
Question by:Jass Saini
  • 8
  • 5
  • 2
  • +3
19 Comments
 

Expert Comment

by:ScotterMonkie
Comment Utility
Hi. Can you show your code, please?
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
Merry Christmas!

I guess I first have to ask; why are you saving after every input?  That's a lot of extra overhead.

As for the behavior, that's what it is; when a record becomes current, move to the first field in the tab order.

So what you'll need to do if you want to continue saving is keep track of the current control, and then in theOnCurrent event, SetFocus to that control yourself.

Jim.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
Why are you saving the record after each input, you do mean every field, right?

Have you checked the TabStop property of each of the controls on your form?  For those you want the user to enter data into, the value should be set to Yes.  You can also modify the tab sequence, in 2007, you open the form in design view, then click on the "Arrange" tab in the ribbon and then select "Tab Order" from the Control Layout section of the ribbon.
0
 

Author Comment

by:Jass Saini
Comment Utility
I only have code to save the record...But after I do the input, the cusor ends up in the first field of the record and I want it to go to the next field.

Private Sub BC1Chng1_AfterUpdate()
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Requery
End Sub

Open in new window

0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
Although there are valid reasons for saving the record when a particular controls value is changed, this is not the norm.  Normally, you would not save the record until all of the required fields have had data entered.  If you have controls which are based on another control, like cascading combo boxes, then you don't need to save the entire record, to force the 2nd or 3rd combo to requery, you simply requery those controls.

Then use the Form_BeforeUpdate event to check whether all of the required fields have values, and if not, then cancel the Update.
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
<<    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Requery
>>

 The question for you is why?  There's no reason to normally.    usually, you let a user enter all the fields, validate the data, then save the record.

Jim.
0
 

Author Comment

by:Jass Saini
Comment Utility
Dale,

I think everytime I do the input into the fields I have it saving the record and I do have the TabOrder correct.  But I think when it saves, it goes back to the front of the record
0
 

Author Comment

by:Jass Saini
Comment Utility
So how do I save the record at the end when the user is done with the inputs...also I have a total in the footer that I need to update based off the field..So I guess that was why I was saving after each input
0
 

Author Comment

by:Jass Saini
Comment Utility
Yep that was it...I need the field to update so it populates the total in the footer.  If I save the form then it was updating the "total" in the footer and this was the only I knew how to save the input and populate the footer field..

Saving each field does have the DB lagging.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 31

Expert Comment

by:Helen_Feddema
Comment Utility
That is very old (ca. Access 95) syntax.  Here is the current syntax for saving a record:

DoCmd.RunCommand acCmdSaveRecord
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
<< But I think when it saves, it goes back to the front of the record >>

  Not only on a save, but the requery causes that as well.   Anytime a new record becomes current, you will move back to the start of the tab order.

<<So how do I save the record at the end when the user is done with the inputs...>>

 Normally, you let the user save, either by clicking a "save" button, short cut key, moving to a new record, etc.

 If you wanted to force a save for some reason, then you could do that in the afterupdate of a control, or use the forms timer to detect if someone has sat too long without saving the record "You haven't saved the record yet, do you wish to save?"

 But normally, you let user action initiate the save.  It's not something you do.

<<also I have a total in the footer that I need to update based off the field..So I guess that was why I was saving after each input >>  

 It will update on it's own.   If you want to force it sooner, then do:

Me.<control name>.Requery

Jim.
0
 

Author Comment

by:Jass Saini
Comment Utility
Hello Jim,

<<also I have a total in the footer that I need to update based off the field..So I guess that was why I was saving after each input >>  

So I

Me.<control name>.Requery    and when I tab over it doesn't update the footer totals.  It only updates when I click in another box with the mouse.  I want to be able to tab over and have it update the footer total as I tab!!!

Thank for helping. I got rid of the save record and I will add a button to have the user save.
0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
Comment Utility
Maybe if you posted a screen shot of your form and what it is your doing, that would help.  Not sure quite sure what your doing, but having to save a record after every control update is not the norm.

Jim.
0
 

Author Comment

by:Jass Saini
Comment Utility
It's the Final_frm...

Also there is alot of coding that don't prefer to this form.  Just want to know how to do the input ..BC1-BC4..and for it to populate the totals in the footer
Database10.accdb
0
 
LVL 34

Expert Comment

by:PatHartman
Comment Utility
I don't mean to equivocate but --- NEVER use Me.Requery or Me.Refresh to save a record.  Those methods have specific uses and saving a record is not one of them.  Saving a record is a side-effect of those methods but as you have discovered, when you don't use the correct SAVE instruction you end up with undesirable side effects since the method is doing what it is intended to do and oh, by the way, it is saving the record.  Helen gave you the correct method for saving a record.

Your problem is a concept one.  The subtotals should not update until the record is saved and the record should not be saved until it is complete.  That is the "Access" way.  The problem with using a RAD tool is that if you want to deviate from the normal method of operation, you have to do a lot of extra work and you still may not get the results you desire.  Your current approach means that you are saving incomplete data since after any field entry, the user could close the form and move on.  This will probably lead to other undesired effects when you get to reporting.
0
 

Author Comment

by:Jass Saini
Comment Utility
You have a point...I  am learning on my own and I am still new at this.  The last guy did his database like that...I just want to be able to populate the totals as I input data in my fields.
0
 
LVL 34

Accepted Solution

by:
PatHartman earned 250 total points
Comment Utility
As long as you don't care if the record is missing data, save whenever you want.  You know what is correct for your app.  Just use the correct save method to avoid the undesirable side effects.  If having empty fields is not acceptable in the finished product then you'll need to make some modifications to other areas of the app.  Add a complete indicator to the table.  In the BeforeUpdate event of the FORM, analyze all the field contents.  If everything is present and valid, set CompleteInd = True, otherwise set it to False.  In your queries,  only select records where CompleteInd = True.  You will also need to add a query/form that runs when the app opens that looks for incomplete records and nag the user to either complete them or delete them.  All in all, a lot of work to populate totals mid form update.
0
 

Author Closing Comment

by:Jass Saini
Comment Utility
Thanks
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
Sorry I'm just getting back to this.

As Pat said, your problem is a conceptual one.  When your adding a new record, it's really not considered part of the totals until it's saved, and prior to that, everything should be valid.

However if you really want to show it as part of the total, then what you can do is get the sum() of existing records, and add the value of the current record.   Might even do it like:

 Existing Records:  <total>   Current Record: <total>   Total Value: Existing Records + Current Record.

The only issue with that is you need to be aware if your adding a new record, or updating an existing one.   If updating an existing record, then the current record is already in the existing records total.

Does that make sense?  If so, let us know what you want to do (don't bother updating the total for the current record, show existing and current as one total, or broken down like I showed above) and we will tell you how to do that.

Jim.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now