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:31:02



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

 
 
 

VB5 - need help with small database app and search

Post by Wayne Michae » Thu, 14 Dec 2000 03:58:49


You have a recordset, now you need to do something with it..

example might be

    do until rst_last_names_found.eof
        list1.add rs_last_names_found("lastname")
        rst_last_names_found.movenext

    loop


>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


 
 
 

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.

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

2. New User Group for Business Objects

3. Need help in makin a small database search

4. Looking for Jr. Oracle DBA position

5. Need Help With VB5 and Searching Access Database

6. wanna COMPACT a table/database

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

8. SQL Synch?

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