Results 1 to 4 of 4
  1. #1
    RickK is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    16

    Need help with next record in form

    I have a form that I use to enter data to a table. The user enters a 10 digit number in field1 and hopefully the same number in field2. There is a field3 that compares the two other fields and if they match, then field3 shows a "match" or if they dont match it shows a "failed" result. This is done using IIf in a query. I also have the field3 formated to turn green if it equals "Match" and it turns red if it equals "failed". This all works fine.



    Currently once the last field is enetred, the form will advance to a new record. And this is fine but I want it to remain on the current record if the value in field3 is "failed" . This allows the user to make the needed corrections. If it is "matched" I want it to progress to a new record.

    What is the best way to do this? Should I use something like DoCmd.GoToRecord, and if so how do I account for the field3 value?

    I hope this makes sense
    Thanks
    Rick

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    So the user just enters in the first 2? Set the cycle property of the form to Current Record, which will leave focus on the same record unless otherwise directed. In the after update event of the second textbox:

    Code:
    If Me.FirstTextbox = Me.SecondTextbox Then
      DoCmd.GoToRecord...
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    RickK is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    16

    That works, but new issue

    Quote Originally Posted by pbaldy View Post
    So the user just enters in the first 2? Set the cycle property of the form to Current Record, which will leave focus on the same record unless otherwise directed. In the after update event of the second textbox:

    Code:
    If Me.FirstTextbox = Me.SecondTextbox Then
      DoCmd.GoToRecord...
    End If
    I was able to use this in a on exit event and it works . Now my problem is when it does go to the new record, the attention stays in the last field from the previous record. It's like it is ignoring the tab order. How can I get it to move the attention to the Field1 which is marked as tab 1?

    This is what I have

    If Me.Text11 = Me.Text13 Then
    DoCmd.GoToRecord , , acNewRec
    End If

    Thanks
    Rick

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Try

    Me.Text11.SetFocus

    In the long run, you'll find naming controls with something appropriate makes it easier to maintain code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-09-2013, 10:39 AM
  2. Replies: 3
    Last Post: 02-06-2013, 07:23 PM
  3. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  4. Replies: 3
    Last Post: 08-26-2012, 10:04 PM
  5. Replies: 2
    Last Post: 07-30-2012, 09:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums