Next record code moves to the next record in two sets of records in two textboxes when it should be only be moving down on one (1 Viewer)

ChazRab

New member
Local time
Today, 15:25
Joined
Oct 6, 2009
Messages
26
..I admit its a clumsy title. I was helped with this Next button by another more experienced member. The code will advance the cursor
position down 1 record as it shout but in two textboxes. These are independent search results.
BUTTON CODE:
Code:
Private Sub NextVerse_Click()
    Dim i As Integer
    Dim sText As String
    
    If Not IsNull(Me.txtNextID) Then
        Call getVerses(Me.txtNextID)
        
    End If
End Sub

CALL GETVERSES(Me.txtNextID) CODE
Code:
Private Sub getVerses(ByVal ID As Variant)
Dim bm As Variant
Dim sKjv As String, sNASB As String
If Not IsNull(ID) Then
    Me.txtID = ID
    Me![txtSearchCriteria] = DLookup("verse", "tblBibles", "ID=" & ID)
    With rs
        .Seek "=", ID
        bm = .Bookmark
        .Move -1 ' Changed 10 to 1 to move 1 verse only not 10
        Me.txtPrevID = !ID
        .Seek "=", ID
        .Move 1 ' Changed 10 to 1 to move 1 verse only not 10
        Me.txtNextID = !ID
        .Bookmark = bm
        i = 1
        Do While Not .EOF
            sKjv = sKjv & !KJV & vbNewLine & vbNewLine
          sNASB = sNASB & !NASB & vbNewLine & vbNewLine
            i = i + 1
            If i > 10 Then
                sKjv = Left$(sKjv, Len(sKjv) - 2)
               sNASB = Left$(sNASB, Len(sNASB) - 2)
                Exit Do
            End If
            .MoveNext
        Loop
    End With
    Me.txtMatchedVerses = sKjv
    Me.Textbox2 = sNASB
End If
End Sub

Issue: every time the Next button is clicked, the cursor moves down to the next record in the first textbox on the left, named txtMatchedVerses.
This code is also moving moving down the records in Textbox2. I cannot correct this code to work only on the first textbox.

Could anyone help?

Thanks, cr
 

Attachments

  • txtMatchedVerses Textbox1 on the left is the only textbox the Next button below should be work...png
    txtMatchedVerses Textbox1 on the left is the only textbox the Next button below should be work...png
    178.3 KB · Views: 29

Gasman

Enthusiastic Amateur
Local time
Today, 21:25
Joined
Sep 21, 2011
Messages
14,472
Only address the first textbox, which I presume from the code is either txtMatchedVerses or Textbox2, likely the first from the names?

This is the issue when you get everything handed to you on a plate. No time is taken to study and understand the code.

TBH in this case you would have been better off asking @arnelgp as it is his code, and he would understand it better than anyone.

For anyone else, carry over from https://www.access-programmers.co.u...next-record-in-a-textbox.330421/#post-1911438, which was also crossposted over on Mr Excel, but that post seems to have died a death.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:25
Joined
May 7, 2009
Messages
19,246
so, dodel?
in case you missed it:
 

ChazRab

New member
Local time
Today, 15:25
Joined
Oct 6, 2009
Messages
26
Only address the first textbox, which I presume from the code is either txtMatchedVerses or Textbox2, likely the first from the names?

This is the issue when you get everything handed to you on a plate. No time is taken to study and understand the code.

TBH in this case you would have been better off asking @arnelgp as it is his code, and he would understand it better than anyone.

For anyone else, carry over from https://www.access-programmers.co.u...next-record-in-a-textbox.330421/#post-1911438, which was also crossposted over on Mr Excel, but that post seems to have died a death.
Sir - you are making an incorrect assumption. I HAVE studied the code. As I previously mentioned - I am new to Access VBA - and I take nothing for granted - why would you even make a remark like'
'when you get everything handed to you on a plate. No time is taken to study and understand the code.' - I resent that statement by you and find that offensive. arenlgp is not only addressing my specific issue with the Next button - but he included in his code much more than I asked for help with because unbeknownst to you, I sent him the entire file via Dropbox. In an effort to further help me, which I did not ask for, he added other things that enhanced the functionality of the application - so now you know what you did not know when you made that assumption.

I realize that in AWF, I'm playing in a world of people who are far beyond my level of experience in developing Access app with Access VBA.
This application, which I fully created in Excel's VBA has outlived Excel's ability to perform because 31,103 rows of data is way more suited to a database rather than a sheet.
-
This is not your basic Northwind customer ->orders application, with subforms, etc. No table normalization or referential integrity is required in this application - this is a textbox visual based, view of a comprehensive Bible software application that far outclasses the efficiency and modeling of Logos - the accepted world benchmark of all Biblical Bible software applications.

So I would request from you and others - have a little more patience and kindness when replying to posts from myself and others who are trying to get help.

cr
Kingwood, Tx
 

Users who are viewing this thread

Top Bottom