Anyone know where best in the following piece of code to give the user notification that no results have been returned from the search and what sort of code might be suitable....
urgent!
Thanks
Private Sub CmdSearch_Click()
MSFlexGrid1.FormatString = " <|PC ID |<PC Vendor |<PC Make/Model |<Memory |<Operating System |<Location |< Business Dept ID"
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source =H:\AssetTracking.mdb"
MSFlexGrid1.Visible = True
Set rs = New ADODB.Recordset
rs.Open "select * from PC where PCMakeModel ='" & TxtMakeModel.Text & "' and BusinessDeptID ='" & TxtBU.Text & "'", adoconnection, adOpenDynamic, adLockOptimistic
Dim irow As Integer
With MSFlexGrid1
.Rows = 2
If ((Not rs.EOF) Or (Not rs.EOF)) Then
rs.MoveFirst
Do While (Not rs.EOF)
irow = .Rows - 1
.TextMatrix(irow, 1) = rs!PCID
.TextMatrix(irow, 2) = rs!PCVendor
.TextMatrix(irow, 3) = rs!PCMakeModel
.TextMatrix(irow, 4) = rs!Memory
.TextMatrix(irow, 5) = rs!OperatingSystem
.TextMatrix(irow, 6) = rs!Location
.TextMatrix(irow, 7) = rs!BusinessDeptID
.Rows = .Rows + 1
rs.MoveNext
Loop
If (.Rows > .FixedRows) Then
.Rows = .Rows - 1
End If
End If
End With
End Sub
urgent!
Thanks
Private Sub CmdSearch_Click()
MSFlexGrid1.FormatString = " <|PC ID |<PC Vendor |<PC Make/Model |<Memory |<Operating System |<Location |< Business Dept ID"
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source =H:\AssetTracking.mdb"
MSFlexGrid1.Visible = True
Set rs = New ADODB.Recordset
rs.Open "select * from PC where PCMakeModel ='" & TxtMakeModel.Text & "' and BusinessDeptID ='" & TxtBU.Text & "'", adoconnection, adOpenDynamic, adLockOptimistic
Dim irow As Integer
With MSFlexGrid1
.Rows = 2
If ((Not rs.EOF) Or (Not rs.EOF)) Then
rs.MoveFirst
Do While (Not rs.EOF)
irow = .Rows - 1
.TextMatrix(irow, 1) = rs!PCID
.TextMatrix(irow, 2) = rs!PCVendor
.TextMatrix(irow, 3) = rs!PCMakeModel
.TextMatrix(irow, 4) = rs!Memory
.TextMatrix(irow, 5) = rs!OperatingSystem
.TextMatrix(irow, 6) = rs!Location
.TextMatrix(irow, 7) = rs!BusinessDeptID
.Rows = .Rows + 1
rs.MoveNext
Loop
If (.Rows > .FixedRows) Then
.Rows = .Rows - 1
End If
End If
End With
End Sub