Results 1 to 3 of 3
  1. #1
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142

    Not In List Moves To Next Record

    I have the following code in my not in list.



    Code:
    Private Sub trbFinancialItem_NotInList(NewData As String, Response As Integer)
    Dim i As Integer
    Dim Msg As String
        If NewData = "" Then Exit Sub
        Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
        Msg = Msg & "Do you want to add it to the list?"
        i = MsgBox(Msg, vbQuestion + vbYesNo, "Financial Item List...")
        If i = vbYes Then
            strSQL = "Insert Into tlkpFinancialItems ([tiItem]) " & _
                     "values ('" & NewData & "');"
            CurrentDb.Execute strSQL, dbFailOnError
         Msg = "'" & NewData & "'has been added to the list, click to resume."
         i = MsgBox(Msg, vbOKOnly, "Financial List Update")
            Response = acDataErrAdded
        Else
            Response = acDataErrContinue
        End If
    End Sub
    It works great however when I click the second msg box it moves to the next record, I copied this code from the Internet and think I may have made some changes that cause this problem.

    Can someone advise how to modify the code so it stays on the same record after the item is added?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You don't have the source of the original code?

    I tested the code and do not get that behavior.

    Since I cannot replicate the issue, would have to review your db.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    So SORRY was dumb, the tab stop was the last one !!!!!!!!!!!!

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

Similar Threads

  1. mouse cursor moves automatically
    By azhar2006 in forum Access
    Replies: 3
    Last Post: 09-29-2014, 02:02 PM
  2. Replies: 17
    Last Post: 11-05-2013, 06:55 PM
  3. Replies: 1
    Last Post: 04-25-2012, 09:33 AM
  4. Replies: 5
    Last Post: 06-29-2010, 06:10 AM
  5. txtbox moves everything else down
    By cowboy in forum Access
    Replies: 2
    Last Post: 01-06-2010, 05:45 PM

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