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..
=============== =============== =============== =============== =============== =====
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
Comment