By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,469 Members | 2,402 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,469 IT Pros & Developers. It's quick & easy.

Need cursor to go to next field after requery

P: 17
I have a form with several subforms. In the main form I need to run a requery for several subforms to update info. But when I requery the cursor goes back to the top of the form. I need the cursor to end up in the next field after the field that contained the requery command. I have done this before but I can't remember the code. Can anyone refresh my memory? Thanks

Assitional Info:
Main Form = Billing Work Form
Field that has requery command= Payroll end
Want cursor to go to new record in: Units Worked Query subform
Thanks
Nov 30 '08 #1
Share this Question
Share on Google+
8 Replies


nico5038
Expert 2.5K+
P: 3,072
Did you try:
Expand|Select|Wrap|Line Numbers
  1. Me.[Units Worked Query subform].setfocus
  2. 'or for a specific field:
  3. Me.[Units Worked Query subform].form!Fieldname.setfocus
  4.  
Nic;o)
Nov 30 '08 #2

P: 17
Thank you! Except the cursor lands in the first record of the subform. Can I get it to land on a new record? Thanks
Nov 30 '08 #3

nico5038
Expert 2.5K+
P: 3,072
For that you'll need to use a bookmark.
You could check out:
Microsoft Access tips: Duplicate the record in form and subform

Nic;o)
Nov 30 '08 #4

P: 17
Nico, I think you missunderstood me? I don't want to duplicate a record. When the cursor lands in the subform, it lands on the first existing record in my datasheet view. I don't want the user to have to hit the new record command to get to a new record. I want the cursor to land on a new record after it rusn the requery. Can you help me? Thanks
Nov 30 '08 #5

nico5038
Expert 2.5K+
P: 3,072
I was pointing to the way the "Bookmark" is used, not the duplication of the record.
With a bookmark you can position in a subform on a particular record.

For the new record a shortcut might be to use the GoToRecord command like:
Expand|Select|Wrap|Line Numbers
  1. Me.[Units Worked Query subform].SetFocus
  2. DoCmd.GoToRecord acActiveDataObject, , acNewRec
  3.  
Nic;o)
Dec 1 '08 #6

P: 17
Nico, Thank you very much. It looks like I misunderstood. Your solution worked great, I really appreciate it.

Dbar10
Dec 1 '08 #7

P: 17
Nico, I am still having trouble. I applied your solution last night but I had it operating on the LostFocus command. I found that the cursor stuck in the new record of subform. I moved the code to the AfterUpdate action and the cursor does not go to the new record in the subform. It goes to the first record in the datasheet instead. I don't understand why it worked on lostfocus and not afterupdate. Can you help me?
Dec 2 '08 #8

nico5038
Expert 2.5K+
P: 3,072
Why don't you use a Requery/Refresh button ?

Nic;o)
Dec 3 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.