473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Need Help in vb6, Please Read?

26
is there any possibilities that you can make a vb6 code, that can search backwards from last to first?


first, i just want to apologize for disturbing you..x)

i mean, from an access 03 database

i inputed in the fieldname: studentnumber

then, i entered below, five(5) records of studentnumber(fieldname) with same value 00001..( this was inputed in access 03 database, not in a vb6 project to lessen the time)

so there are five(5) of same studentnumber, w/c is 00001?

so, here is the thing, a vb6 code using (textbox1_change) must search backwards start from the fifth(5th) record 00001 to the first record...

(the searched studentnumber must shown also in a textbox2)

with a moveprevious and movenext commandbuttons...(to determine if it starts from last to first string)

if you know this one, can i do a favor? to make an example and post it here.

cause i just also want to know it...

remember: sharing is good... for like me who wants to know the possibilities.

hope you help me, that's if your not busy...

thanks in advance...GOD bless...

all answers is much more appreciated... again thanks for sharing...
Feb 18 '10 #1

✓ answered by vb5prgrmr

use an ORDER BY statement in your select query.

Good Luck

4 1319
vb5prgrmr
305 Expert 100+
use an ORDER BY statement in your select query.

Good Luck
Feb 20 '10 #2
psyvanz
26
i'd tried that one..

studentnumber(fieldname)

example: studentnumber(fieldname) had 10 same recorded number 00001..

how it will goto the last record or the 10th record directly?

coded like this:

query (select * from tb1 order by studentnumber)

but the problem is, it always starts at the first record? not on the 10th record

will you help me on how to find the last record only..

you may EDIT this code..

thanks again for sharing..and thanks in advance for EDITING...
Feb 21 '10 #3
vb5prgrmr
305 Expert 100+
Okay, to move to the last record then you can use...
Expand|Select|Wrap|Line Numbers
  1. Rs.MoveLast
  2.  
Then to move from the last to the first...
Expand|Select|Wrap|Line Numbers
  1. Do While Not Rs.BOF
  2.   'do whatever
  3.   Rs.MovePrevious
  4. Loop
  5.  


Good Luck
Feb 21 '10 #4
psyvanz
26
here is the code im working with?

it is a dataenvironment, im sure you knew this code?

it is same like ADODC OR A MODULE code?

if you dont know, please forward this to your experts friend who knew how to twick or trace the error..

this code only search the first record... you had been search..

Expand|Select|Wrap|Line Numbers
  1. Private Sub old_Change() ' this is a textbox, 
  2.  
  3. 'that searches only the first entered studentnumber 00001, but they're lots of 
  4. 'inputed like 00002.. so on and so fort, but i inputed (3) three 00001. '
  5. 'cause i want this search code must find the last record 00001, not the last "anynumber" in a database.
  6. ' ONLY the Search number entered in the "old.text" w/c i search "00001" must seek not the 00002 or the last record inputed in the database...
  7.  
  8. 'meaning... (3)00001,(1)00002,(1)00003
  9.  
  10. 'if i code rs.movelast only IM SURE IT GOTO THE LAST RECORD WHICH WAS 00003.. 
  11. 'but i want to only the last record of 00001, because it is a search command.
  12.  
  13. 'hope you will help me to fix this code...
  14.  
  15. 'thanks...x)
  16. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  17. On Error Resume Next
  18.  
  19. Dim findstr As String
  20.  
  21.     If Not DataEnvironment1.rsTranSub.Supports(adFind) Then
  22.         MsgBox " Doesn't support Recordset "
  23.  
  24.     Else
  25.         If DataEnvironment1.rsTranSub.Supports(adBookmark) Then
  26.            lastrow = DataEnvironment1.rsTranSub.Bookmark
  27.  
  28.         End If
  29.  
  30.         findstr = old.Text
  31.         If findstr = "" Then Exit Sub
  32.  
  33.  
  34.  
  35.         'DataEnvironment1.rsTranSub.Movelast
  36.  
  37. ' I think here is the code i can't fixed below:
  38.  
  39.             DataEnvironment1.rsTranSub.find "studentnumber LIKE '*" & findstr & "*'"                
  40.          '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  41.             If DataEnvironment1.rsTranSub.EOF Then
  42.                MsgBox "No records found!" & findstr
  43.  
  44.             If DataEnvironment1.rsTranSub.Supports(adBookmark) Then
  45.                 DataEnvironment1.rsTranSub.Bookmark = lastrow
  46.  
  47.             End If
  48.       End If
  49.         End If
  50.  
  51. End Sub
Feb 22 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: NJ | last post by:
MAKE MONEY FAST AND EASY HURRY!!!! Make Money Fast A little while back, I was browsing these newsgroups, just like you are now, and came across an article similar to this that said you could make...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
1
by: Urs Eichmann | last post by:
regarding partial classes and form designer http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?FeedbackId=a2e101a4-67ed-4478-a072-6fa1986b751b Thanks, Urs
2
by: childofthehorn | last post by:
Okay, so I can get this to read the first line of a txt document. I just can't figure out how to get it to read the next lines. I have to use "user_input" in a function. The wait function just waits...
6
by: pagoto123 | last post by:
hello.. i need to read picture or notepad from access database .. i make the access column a ole object i put the photo but when i photo.text = myreader(1) then it says conversion from byte to...
1
AdrianH
by: AdrianH | last post by:
Before posting in this forum please read the Posting Guidelines available in the site Help. If you are a student or if you are answering a students questions then please pay special attention to...
1
by: Winpygsfli | last post by:
I have an application that has an iFrame wich houses a form. I need to read the value of a specific input field from the iFrame. iFrame - portalArea Form - frmUserProfile Input field -...
8
by: rohanit46 | last post by:
i need to read xml content from a web service onto a local machine and parse the data using javascript. While using XMLHttpRequest, it allows me to access xml content from anywhere on local...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.