Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

eVB Database Viewer

Written by Jason Freih  [author's bio]  [read 64043 times]
Edited by Derek

Download the code

Page 1  Page 2  Page 3  Page 4  Page 5  Page 6 

I should say at this point that there are other ways to extract the field information, I just found this worked the best for me.

Using the buttons below the grid allows me to navigate through the table. The following sub-routines are used.

Private Sub cmdFirst_Click()
'Move to the First Record
rsWorkingTbl.MoveFirst
GridRec_ReFill
lblDispMsg.Caption = rsWorkingTbl.AbsolutePosition & " / " & iRecCnt
End Sub

Private Sub cmdLast_Click()
'Move to the Last Record
rsWorkingTbl.MoveLast
GridRec_ReFill
lblDispMsg.Caption = rsWorkingTbl.AbsolutePosition & " / " & iRecCnt
End Sub

Private Sub cmdNext_Click()
' Move to the Next Record
If Not rsWorkingTbl.EOF Then rsWorkingTbl.MoveNext
'If you don't check for EOF again you will get an error
' before EOF registers
If Not rsWorkingTbl.EOF Then
GridRec_ReFill
lblDispMsg.Caption = rsWorkingTbl.AbsolutePosition & " / " & iRecCnt
Else
lblDispMsg.Caption = "End Of Record"
End If
End Sub

Private Sub cmdPrev_Click()
'Move to The Previous Record
If Not rsWorkingTbl.BOF Then rsWorkingTbl.MovePrevious
'If you don't check fore BOF again you will get an error
' before BOF registers
If Not rsWorkingTbl.BOF Then
GridRec_ReFill
lblDispMsg.Caption = rsWorkingTbl.AbsolutePosition & " / " & iRecCnt
Else
lblDispMsg.Caption = "Beginning Of File"
End If
End Sub

CODE 16 (Form)

Not that there are two routines for populating the grid when viewing the information on a record by record basis. First the RecView_Fill function populates the grid with both the field names and the values. But once we start scrolling through the records the RecView_ReFill function is used. This function only updates the values (left hand column). This is done to speed up the scrolling, as the field names don't change there is no reason to read them all over again.

Private Sub GridRec_ReFill()
'Display DB-Grid For individual records
'Assuming it has been created the first time by
'GridRec_Fill function

Dim sRec As String
Dim iRecNo As Integer
Dim i As Integer

'Hide text box and Grid while being updated
txtBox.Visible = False
Grid1.Visible = False
Grid1.Col = 1

iRecNo = rsRecords.RecordCount

For i = 1 To iRecNo
Grid1.Row = i - 1
Grid1.Col = 0
sRec = Grid1.Text
Grid1.Col = 1
If IsNull(rsWorkingTbl.Fields(sRec)) Then
Grid1.Text = " "
Else
Grid1.Text = rsWorkingTbl.Fields(sRec)
End If
Next

Grid1.Visible = True
txtBox.Visible = True
Grid1.Row = 0
Grid1.Col = 0

End Sub

CODE 17 (Form)

That about covers viewing information from a table.

Now lets look at how to look at the information from a SELECT statement.

Using the same text Box as for viewing the information from when scrolling through a grid, the text box is expended so that a bigger SELECT statement can be typed in.

Private Sub cmdSQL_Click()
'Display Text Box to Enter Select Statement

lblDispMsg.Caption = "Enter SELECT Statement"
Grid1.Visible = False
'Expand the Height of the txtBox to Allow to type in a
'larger SELECT statment
txtBox.Height = 2052
txtBox.Visible = True
txtBox = ""
BtnShow ("000100000")
Me.cmdViewGrid.Width = 3252
End Sub

CODE 18 (Form)

Previous Page  Next Page