473,409 Members | 2,004 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,409 software developers and data experts.

Movenext Events

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 botton.

I hope you can help me as soon as possible. this is my codes.

Private Sub cmdnext_Click()
Dim cnn1 As ADODB.Connection
Dim rstinvoice As Recordset
Set cnn1 = New ADODB.Connection
Dim strCnn, i, N As String
Set rstinvoice = New Recordset

rstinvoice.Open

While Not rstinvoice.EOF
rstinvoice.MoveNext
Wend

End Sub

Private Sub txtinvoice_Change()
Dim cnn1 As ADODB.Connection
Dim strCnn As String
Dim rstinvoice As Recordset


Set cnn1 = New ADODB.Connection
strCnn = "Provider=sqloledb;" & _
"Data Source=SWMSSQL;Initial Catalog=SWMS-2;User Id=sa;Password=123;"
cnn1.Open strCnn

Set rstinvoice = New ADODB.Recordset

rstinvoice.CursorLocation = adUseClient

rstinvoice.Open "select * from invoice WHERE invoiceno = '" & txtinvoice.Text & "'", cnn1, adOpenKeyset, adLockOptimistic, adCmdText

If rstinvoice.RecordCount < 1 Then
Else
txtisn.Text = rstinvoice!ISN
txtorderno.Text = rstinvoice!orderno
txtpartno.Text = rstinvoice!partid
txtpartname.Text = rstinvoice!partname
txtinvqty.Text = rstinvoice!invqty
txtrcvqty.Text = rstinvoice!rcvqty
txtppq.Text = rstinvoice!ppq
txtpackstart.Text = rstinvoice!PackNoStart
txtpackend.Text = rstinvoice!PackNoEnd
txtpackinv.Text = rstinvoice!packinvcount
txtpackrcv.Text = rstinvoice!packrcvcount
txtdndate.Text = rstinvoice!dnloaddate
txtrcvdate.Text = rstinvoice!rcvdate
txtshipment.Text = rstinvoice!shipmentno
txtcontainer.Text = rstinvoice!containerno
txteta.Text = IIf(IsNull(rstinvoice!etamanila), "", rstinvoice!etamanila)
txtetafac.Text = IIf(IsNull(rstinvoice!etafactory), "", rstinvoice!etafactory)
End If
End Sub
Aug 30 '06 #1
2 2605
Reena83
32
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 botton.

I hope you can help me as soon as possible. this is my codes.

Private Sub cmdnext_Click()
Dim cnn1 As ADODB.Connection
Dim rstinvoice As Recordset
Set cnn1 = New ADODB.Connection
Dim strCnn, i, N As String
Set rstinvoice = New Recordset

rstinvoice.Open

While Not rstinvoice.EOF
rstinvoice.MoveNext
Wend

End Sub

Private Sub txtinvoice_Change()
Dim cnn1 As ADODB.Connection
Dim strCnn As String
Dim rstinvoice As Recordset


Set cnn1 = New ADODB.Connection
strCnn = "Provider=sqloledb;" & _
"Data Source=SWMSSQL;Initial Catalog=SWMS-2;User Id=sa;Password=123;"
cnn1.Open strCnn

Set rstinvoice = New ADODB.Recordset

rstinvoice.CursorLocation = adUseClient

rstinvoice.Open "select * from invoice WHERE invoiceno = '" & txtinvoice.Text & "'", cnn1, adOpenKeyset, adLockOptimistic, adCmdText

If rstinvoice.RecordCount < 1 Then
Else
txtisn.Text = rstinvoice!ISN
txtorderno.Text = rstinvoice!orderno
txtpartno.Text = rstinvoice!partid
txtpartname.Text = rstinvoice!partname
txtinvqty.Text = rstinvoice!invqty
txtrcvqty.Text = rstinvoice!rcvqty
txtppq.Text = rstinvoice!ppq
txtpackstart.Text = rstinvoice!PackNoStart
txtpackend.Text = rstinvoice!PackNoEnd
txtpackinv.Text = rstinvoice!packinvcount
txtpackrcv.Text = rstinvoice!packrcvcount
txtdndate.Text = rstinvoice!dnloaddate
txtrcvdate.Text = rstinvoice!rcvdate
txtshipment.Text = rstinvoice!shipmentno
txtcontainer.Text = rstinvoice!containerno
txteta.Text = IIf(IsNull(rstinvoice!etamanila), "", rstinvoice!etamanila)
txtetafac.Text = IIf(IsNull(rstinvoice!etafactory), "", rstinvoice!etafactory)
End If
End Sub




Hope this helps:

Private Sub cmdNext_Click()
'goto the next record
rstInvoices.MoveNext
If rstInvoices.EOF Then
MsgBox ("At the last record")
rstInvoices.MoveLast

End If

'display the record details
Call showData
End Sub
Sep 21 '06 #2
Private Sub cmdNext_Click()

''First If U Find Record Set is End Of line After If U Use Move Next Command

If rstInvoices.EOF Then
MsgBox ("At the last record")
rstInvoices.MoveLast
exit sub
End If
rstInvoices.MoveNext
'display the record details
Call showData
End Sub
Thanking U(For U'r Reply)
Sep 22 '06 #3

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: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
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...
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: 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. ...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.