Solved

After User Input have the cusor in the next field

Posted on 2014-12-24
19
179 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
ID: 40516851
Hi. Can you show your code, please?
0
 
LVL 57
ID: 40516853
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)
ID: 40516854
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:Jass Saini
ID: 40516855
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)
ID: 40516868
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
ID: 40516869
<<    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
ID: 40516873
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
ID: 40516882
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
ID: 40516890
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
 
LVL 31

Expert Comment

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

DoCmd.RunCommand acCmdSaveRecord
0
 
LVL 57
ID: 40516954
<< 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
ID: 40518763
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
ID: 40518855
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
ID: 40518882
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 35

Expert Comment

by:PatHartman
ID: 40519024
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
ID: 40519119
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 35

Accepted Solution

by:
PatHartman earned 250 total points
ID: 40519922
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
ID: 40521985
Thanks
0
 
LVL 57
ID: 40522159
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

791 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