VB5 -need help with small database app and search

VB5 -need help with small database app and search

Post by Patricia Sendrof » Thu, 14 Dec 2000 00:35:09



Hi folks,

I'm still trying to get this search right, could someone tell me what I am
doing wrong?

The fields on my form are not updating.
If I type in a name into the input box that I know is not in the database, I
get the msgbox saying "no records found"

If I try it with a know good name, no results come up.

Help for this simple (to you guys...) problem would sure be appreciated...

Thanks
--Patti S.
******************************************
Private Sub cmdsqlsearch_Click()
Dim dbcurrent As Database
Dim rst_last_names_found As Recordset
 ' would be what the sql returns
Dim strSQL_Lastname As String
' the sql query itself
Dim strInput As String
' what the user inputs into the input box

Set dbcurrent = OpenDatabase("C:whereveritis\mydatabase.mdb")
      'opens the database

strInput = InputBox("Last name to search by?", "Search Dialog")
'gets the input from the input box

strSQL_Lastname = "SELECT * from boxform  WHERE [Lastname] = '" & strInput &
"'"
'boxform is a table in shoebox.mdb
    'running the query

Set rst_last_names_found = dbcurrent.OpenRecordset(strSQL_Lastname)

If rst_last_names_found.RecordCount = 0 Then

MsgBox "no matches found"
 'this part works o.k.

else
rst_last_names_found.movefirst

End If

 
 
 

1. VB5 - need help with small database app and search

Hi folks,

I'm still trying to get this search right, could someone tell me what I am
doing wrong?

The fields on my form are not updating.
If I type in a name into the input box that I know is not in the database, I
get the msgbox saying "no records found"

If I try it with a know good name, no results come up.
(I think I need to bind the fields to the data control to show the new
records, but not sure how to do this.)

Oh well, at least I have gotten this far...   :)
*******************************************
Private Sub cmdsqlsearch_Click()
Dim dbcurrent As Database
Dim rst_last_names_found As Recordset
' would be what the sql returns
Dim strSQL_Lastname As String
' the sql query itself
Dim strInput As String
' what the user inputs into the input box

Set dbcurrent = OpenDatabase("C:whereveritis\mydatabase.mdb")
      'opens the database

strInput = InputBox("Last name to search by?", "Search Dialog")
'gets the input from the input box

strSQL_Lastname = "SELECT * from boxform  WHERE [Lastname] = '" & strInput &
"'"
'boxform is a table in shoebox.mdb
    'running the query

Set rst_last_names_found = dbcurrent.OpenRecordset(strSQL_Lastname)

If rst_last_names_found.RecordCount = 0 Then

MsgBox "no matches found" 'this part works o.k.

else
rst_last_names_found.movefirst

End If

2. Fox Dos 2.6->VFP problems

3. Need help in makin a small database search

4. the need of scope

5. Need Help With VB5 and Searching Access Database

6. problem with sql plus

7. VB5 Set up need help can't run app on clients comp

8. email report to operator not working

9. Help needed- VB5 app to enter data in Access DB

10. Search App - NEED HELP !!!

11. Help With Creating CSV, EXCEL,FOXPRO databases within a VB5 App

12. Help vb5 app to read/write access database under application control

13. HELP - Database Setup App Help NEEDED ???