473,386 Members | 1,823 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,386 software developers and data experts.

how to moveprevious and movenext

Hi,

I have developed a small application in vb6 and access Actually i want to move through recordset i.e movenext and move previous but it always go to end of record.I have stuck up in this and not able to solve this problem.Please help me.Thanks in advance. I am using access database and following is my code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdnext_Click()
  2. On Error Resume Next
  3.  
  4.     Set con = New ADODB.Connection
  5.     Set rs = New ADODB.Recordset
  6.     rs.Open "cust1", strcn
  7.     While Not rs.EOF
  8.         rs.MoveNext
  9.         filldata
  10.     Wend
  11. End Sub
  12.  
  13.  
  14. Private Sub cmdprevious_Click()
  15.     rs.Close
  16.     Set rs = New ADODB.Recordset
  17.     rs.CursorType = adOpenStatic
  18.     rs.CursorLocation = adUseClient
  19.     rs.Open "cust1", strcn, adOpenStatic, adLockReadOnly, adCmdTable
  20.     MsgBox rs.RecordCount
  21.     rs.MovePrevious
  22.  
  23.     If Not rs.BOF = True Then
  24.         rs.MoveFirst
  25.         MsgBox ("This is first record")
  26.  
  27.     End If
  28. filldata
  29. end sub
  30.  
  31. Sub filldata()
  32.     txtcode.Text = rs.Fields!code
  33.     txtfullname.Text = rs.Fields!fullname
  34.     cmbstatus.Text = rs.Fields!Status
  35.     txtname.Text = rs.Fields!Name
  36.     txtpobox.Text = rs.Fields!pobox
  37.     txttel.Text = rs.Fields!offtel
  38. End Sub
Apr 15 '07 #1
1 6324
iburyak
1,017 Expert 512MB
Change adOpenStatic to adOpenDynamic

Good Luck.
Apr 15 '07 #2

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

Similar topics

2
by: darrel | last post by:
If I create a node iterator using an xpath expression pointing to a specific node, this will give me the value of that node: ni.movenext() ni.current.tostring However, this doesn't: ...
3
by: trint | last post by:
Ok, MoveNext is only moving to the next record once, then it stays on that record unless I use these (which work just fine) MoveLast MoveFirst MovePrevious. private void btnNext_Click(object...
6
by: kitt | last post by:
Hi everyone, I am kind of new in VB programming. I am using SQL as my database. The fields are 1.serial 2.datestring 3.Job 4.Achievement 5.Remarks I wanted to go from one record to the next but...
2
by: piolo0879 | last post by:
hi good afternoon I have a problem i used a table in SQL. I already display the information to txtbox coming from table. My problem was i want to display the next record when we click the next...
2
by: akanialaka | last post by:
Hope I can get some help here... I connect to an SQL database using ASP. I can see the records. I have a small (very basic) function written in Javascript. When I use the MoveNext in the...
4
by: praveenkhebbar | last post by:
Hi, I have written a code to display records from the ms access table on a form using text boxes, combos. When I execute the rs.movenext command ideally it should move to the next record in the...
1
by: shoram | last post by:
hey i need some help in asp (vbscript) : i need something to be done in a way that i don't really understand i need my recordset object's pointer to be at a specific point (a parameter) and from...
1
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. ...
2
by: beceri | last post by:
Hi I use this code ; Dim tumrecord As New ADODB.Recordset With tumrecord strrecord = .Open strrecord, CurrentProject.Connection, adOpenStatic If .RecordCount > 0 Then Do...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.