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...

Recommended Answers

All 3 Replies

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.