Viewing records from an table.

Many had been asking about how to view records this tells  how to view records from database.

Private Sub Command7_Click()
‘code for view
On Error GoTo q
Dim viewv As Integer
viewv = InputBox(“enter the voter id”)
On Error GoTo w
‘again you type it in a line this code runes
rsv.Open “select id,name,address,age,gender,dob from voter where id=’ ” & viewv & ” ‘”, conv, adOpenDynamic, adLockOptimistic

Text5.Text = rsv.Fields(“id”)
Text2.Text = rsv.Fields(“name”)
Text3.Text = rsv.Fields(“address”)
Combo1.Text = rsv.Fields(“age”)

If (rsv.Fields(“gender”) = “male”) Then
Option1.Value = True
ElseIf (rsv.Fields(“gender”) = “female”) Then
Option2.Value = True
End If

DTPicker1.Value = rsv.Fields(“dob”)

If (rsv.State = 1) Then
rsv.Close
End If

MsgBox “view”
Exit Sub

q: MsgBox “you cancelled”
Exit Sub

w: MsgBox “value not present in database”

End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s