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

MoveNext

5
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 I just couldn't get to it. I tried using rs.MoveNext, but it didn't work. I think I am unable to get to some things.

Your help would be highly appreciated.
Kitt
Jul 12 '06 #1
6 6275
sashi
1,754 Expert 1GB
Hi Kitt,

post your current code segment and we will try to debug the code.. it's kind of impossible to guide you without seeing your code.. good luck my fren.. :)
Jul 12 '06 #2
kitt
5
Following is my code. I look forward for your help.

Dim con As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub cmdNext_Click()
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.Open
rs.MoveNext
End Sub


Private Sub CmdSave_Click()
Dim save As String
Set rs = New ADODB.Recordset
save = "insert into Evaluation values('" & serial.Text & "', '" & DateString.Text & "','" & Job.Text & "', '" & Achievement.Text & "', '" & Remarks.Text & "')"
rs.Open save, con, adOpenDynamic, adLockOptimistic
serial.Text = ""
DateString.Text = ""
Job.Text = ""
Achievement.Text = ""
Remarks.Text = ""
End Sub


Private Sub CmdSearch_Click()
Dim search As String
Set rs = New ADODB.Recordset
search = "select * from Evaluation where SlNo = '" & serial.Text & "' or Date = '" & DateString.Text & "' or JobResponsibilities = '" & Job.Text & "' or Achievement = '" & Achievement.Text & "'"
rs.Open search, con, adLockOptimistic, adOpenDynamic
serial.Text = rs!SlNo
DateString.Text = rs!Date
Job.Text = rs!JobResponsibilities
Achievement.Text = rs!Achievement
Remarks.Text = rs!Remarks
End Sub

Private Sub Form_Load()
Dim constr As String
Set con = New ADODB.Connection
constr = " Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;PWD=sa;Initial Catalog=Library;Data Source=PENJOR"
con.Open constr
End Sub
Jul 13 '06 #3
sashi
1,754 Expert 1GB
Hi Kitt,

i have made some changes to your Sub cmdNext.. pls take note..

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdNext_Click()
  2. Set con = New ADODB.Connection
  3. Set rs = New ADODB.Recordset
  4. rs.Open
  5.   While Not rs.EOF   
  6.     rs.MoveNext
  7.   Wend
  8. End Sub
  9.  
Jul 13 '06 #4
kitt
5
I tried the code you suggested but I get the following error:
Run-time error '3709'
The connection cannot be used to perform this operation. It is either closed or invalid in this context.

I look forward for your help again.
Jul 13 '06 #5
sashi
1,754 Expert 1GB
Hi Kitt,

there is nothing wrong in the code segment.. i have found the reason for the error message.. check it out.

"Run-Time Error '3709'" error message when you enter a large amount of text in a Memo field that contains an index

exactly when and where does this error occur? i assume it's when you tried saving record.. rite?? check your coding.. good luck my fren.. :)

http://www.support.microsoft.com/?sc...d=2509&sid=665
Jul 13 '06 #6
kitt
5
Dear Sasi,
I am sorry for bothering you time and again. But then, I really need your help and I am grateful that you do help. The error occurs when I click the 'next' button. I can save the record but I cannot go to the next record.

The error occurs on 'rs.open'.

Kitt
Jul 14 '06 #7

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: ...
5
by: trint | last post by:
Ok, Everything connects correctly and loads properly in this WebApplication. I have four buttons and all work correctly except one (the NEXT RECORD button). PREVIOUS, FIRST and LAST all work...
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...
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...
1
by: sanika150780 | last post by:
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...
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. ...
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: 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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.