×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DoCmd.GoToRecord - help with correct syntax

DoCmd.GoToRecord - help with correct syntax

DoCmd.GoToRecord - help with correct syntax

(OP)
I am having problems refering to a field or control on a subform.

What I am trying to do is this:
I have a main form called [FrmItems] and 2 subforms [SubFrm1] & [SubFrm2]. Both sub forms are displayed as datasheets and on [SubFrm1] is a field or control called [ItemID]. I also have a button on the *MAIN* form that the user, (after first selecting a record in [Subfrm1]), clicks and this then runs a query.

I then want access to move to the next record in [SubFrm1] after this query has run. I have tried various combinations of refering to the [ItemID] but none of them seem to work. I keep getting error messages.

Am i doing something wrong please.

This is the two lines of code that I have after the RunQuery code:

DoCmd.GoToControl Forms!FrmItems!SubFrm1.Form = ItemID
DoCmd.GoToRecord , ItemID, acNext

Can someone help me please as I am totally stuck.

Thank you,

Kenny

RE: DoCmd.GoToRecord - help with correct syntax

Replace your code below with the new code listed.

Old code
DoCmd.GoToControl Forms!FrmItems!SubFrm1.Form = ItemID
DoCmd.GoToRecord , ItemID, acNext

New code
Me.SubForm1.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acNext

Let me know if this works for you. I tried it on my form and it works.

John A. Gilman
gms@uslink.net

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close