0

how to fix a search function in vb 6.0 to search in ms access database.
i have installed vb & ms access only.and i want to generate a report of search result in the form.


thanks for any help...

4
Contributors
3
Replies
8
Views
7 Years
Discussion Span
Last Post by fourty
0

Well, for starters you will have to design your database first with tables and fields. Then populate the tables with some data and then start your search.

If you say "fix a search function", does that mean that you have done the above and get errors when searching?

0

Hey Gurrupts
You can try this code..(we assume that departments is the table from which we are seaching)
GoodLuck.

Private Sub cmdsearch_Click()
Dim Mloop As Integer
Dim found As String
'Input Number to search
Mloop = 0
found = InputBox("Enter Number", "Search")
If found = "" Then
Exit Sub
End If

DataEnvironment.rsdepartments.MoveFirst 'Move the pointer to the first record
Do While Mloop = 0
If txtNo = found Then 'if search found display an alert message
Exit Sub
End If

If DataEnvironment.rsdepartments.EOF Then 'if search not found display an error message
MsgBox "Enter VALID No", vbCritical, "Find"
DataEnvironment.rsdepartments.Requery
Exit Sub
End If
DataEnvironment.rsdepartments.MoveNext
Loop

End Sub

Fourty.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.