Need help in searching in last record of a file in ms access 03, in vb6?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psyvanz
    New Member
    • Sep 2009
    • 26

    Need help in searching in last record of a file in ms access 03, in vb6?

    here is the code im working with...

    hope you can understand? cause this thing searches the first one, not the last one record...

    i wanted ONLY to find the last record in a table...

    Please help me what was wrong with my code..

    =============== =============== =============== =============== =============== =====

    Code:
    Private Sub old_Change()
    
    'this deals with school billing, thats why i need to ("search") go to his/her last payment record... 
    
    'I USED MS ACCESS'03 IN THIS VB6 PROJECT?
    
    'THIS CODE SEARCHES ONLY THE FIRST ENTERED OR INPUTED RECORD IN THE TABLE..
    
    'MY PROBLEM IS, ON HOW THIS "CODE" FIND THE "LAST ADDED RECORD" IN THE TABLE..
    
    '"MEANING, IT MUST FIND THE LAST ENTERED RECORD", NOT THE FIRST RECORD?
    
    'noted: you must have a "dataenvironment designer" to run this!
    
    
    On Error Resume Next
    
    "Designer"     ."Tablename". "Command"
        |	             |          |
    DataEnvironment1.rsTranSub.MovePrevious
    ''''''''''''''''''''''''''''''''''''
    DataEnvironment1.rsTranSub.MoveLast
    DataEnvironment1.rsTranSub.MoveNext
    DataEnvironment1.rsTranSub.MoveFirst
    
    On Error Resume Next
    
    Dim findstr As String
    
        If Not DataEnvironment1.rsTranSub.Supports(adFind) Then
            MsgBox " Doesn't support Recordset "
            
        Else
            If DataEnvironment1.rsTranSub.Supports(adBookmark) Then
               lastrow = DataEnvironment1.rsTranSub.Bookmark
            
            End If
            
            findstr = old.Text
            If findstr = "" Then Exit Sub
    
            'DataEnvironment1.rsTranSub.Movelast
     
    ' I think here is the code i can't fixed below:
          
            	DataEnvironment1.rsTranSub.find "studentnumber LIKE '*" & findstr & "*'"
                    
             '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                If DataEnvironment1.rsTranSub.EOF Then
                   MsgBox "No records found!" & findstr
              
                If DataEnvironment1.rsTranSub.Supports(adBookmark) Then
                    DataEnvironment1.rsTranSub.Bookmark = lastrow
             
                End If
          End If
            End If
        
    End Sub
  • psyvanz
    New Member
    • Sep 2009
    • 26

    #2
    looks like you have'nt try coding using this....

    if you have a code that can search the last record in a database... particurlary multi studentnumber.. .. you can post it here.... thanks in advance... GOD bless...


    -------studnum | paid
    sample: 000001 | 100
    ------- 000001 | 200 > it must search here not the first student number... the last record searched....w/c is 000001.. using textbox.. to search...

    Comment

    Working...