i am using acees 2007 with vb.
i have records stord there and i want to view them through my application by the next and previous buttons, but when i press the next button it will not move to the other record.
below is the code;
this is for the next button
Expand|Select|Wrap|Line Numbers
- Private Sub nextcmd_Click()
- If rs.RecordCount > 0 Then
- rs.MoveNext
- If (Not rs.EOF) Then
- Prevcmd.Enabled = True
- fill_data
- Else
- nextcmd.Enabled = False
- Prevcmd.Enabled = True
- fill_data
- End If
- End If
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub fill_data()
- If rs.BOF Or rs.EOF Then txtserial.Locked = True
- 'txtdate.Locked = True
- txtserial.Locked = True
- txtname.Locked = True
- txtcpr.Locked = True
- txtphone.Locked = True
- cmddesc.Locked = True
- cmdprice.Locked = True
- txtcomments.Locked = True
- 'txtcashier.Locked = True
- cmdtype.Locked = True
- 'txtdate.Locked = True
- Set cn = New ADODB.Connection
- cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=C:\Users\nooras\Desktop\revenue\rev system\LoginExample\Users.mdb;"
- '~~> Open a recordset
- Set rs = New ADODB.Recordset
- '~~> Open the recordset
- rs.Open "SELECT * FROM Table2", cn, , , adCmdText
- txtserial = rs!serial
- txtname = rs!customername
- txtcpr = rs!cpr
- txtphone = rs!phonenumber
- cmddesc = rs!Description
- cmdprice = rs!payment
- txtcomments = rs!Comments
- 'txtcashier = rs!cashier
- cmdtype = rs!paymenttype
- 'txtNo = rs!ViewNo
- 'txtname = rs!Name
- 'txtcpr = rs!cpr
- 'txtdate = rs!Date
- txtserial = ""
- txtname = ""
- txtcpr = ""
- txtphone = ""
- cmddesc = ""
- cmdprice = ""
- txtcomments = ""
- 'txtcashier = rs!cashier
- cmdtype = ""
- 'txtNo = ""
- ' txtname = ""
- ' txtcpr = ""
- ' txtdate = ""
- Else
- If IsNull(rs!serial) Then txtserial = "" Else txtserial = rs!serial
- If IsNull(rs!customername) Then txtname = "" Else txtname = rs!customername
- If IsNull(rs!cpr) Then txtcpr = "" Else txtcpr = rs!cpr
- If IsNull(rs!phonenumber) Then txtphone = "" Else txtphone = rs!phonenumber
- If IsNull(rs!Description) Then cmddesc = "" Else cmddesc = rs!descreption
- If IsNull(rs!payment) Then cmdprice = "" Else cmdprice = rs!payment
- 'If IsNull(rs!Date) Then txtdate = "" Else txtdate = rs!Date
- End If
- txtserial.Locked = True
- txtname.Locked = True
- txtcpr.Locked = True
- txtphone.Locked = True
- cmddesc.Locked = True
- cmdprice.Locked = True
- txtcomments.Locked = True
- 'txtcashier.Locked = True
- cmdtype.Locked = True
- 'txtdate.Locked = True
- End Sub