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