SQL Query in VB5. 
Author Message
 SQL Query in VB5.

I am a novice to VB programming and am looking for any help possible.

I have created a Small Access (7.0)  Database and wish to use VB5 to
create a user front end for it.

What I wish to do is query the database by prompting the user for a
search critera ie. "Name of Person", this would then return to the
screen the details of that person.  I thought I could do this by using
an Inputbox or ComboBox.  However I am tearing my hair out as I can't
get it to work!

Any help at all would be grately appreiciated.

Thanks

Paul.



Thu, 01 Nov 2001 03:00:00 GMT  
 SQL Query in VB5.
using a combobox should work. you just need to add some codes to it.
(i'm assuming here you do know how to populate your combobox)
put a command button in your form and in the Command1_Click event, add
the necessary code.
something like this:

Dim db as database
Dim rs as recordset
Dim sQSL as string

Set db = OpenDatabase(dbName)
Set rs = db.OpenRecordset("SELECT Field1, Field2 FROM Table1",
dbOpenDynaset)
sSearchString = "Field1 = '"
With rs
   .FindFirst sSearchString & Combo1.text & "'"
   text1= !Field1
   text2= !Field2
End With

rs.Close
db.Close

This assumes that in your form you have 2 text boxes (used to output
your query results), 1 combobox (used for your search string) and 1
command button (used to execute your search).

hope this helps


Quote:

> I am a novice to VB programming and am looking for any help possible.

> I have created a Small Access (7.0)  Database and wish to use VB5 to
> create a user front end for it.

> What I wish to do is query the database by prompting the user for a
> search critera ie. "Name of Person", this would then return to the
> screen the details of that person.  I thought I could do this by using
> an Inputbox or ComboBox.  However I am tearing my hair out as I can't
> get it to work!

> Any help at all would be grately appreiciated.

> Thanks

> Paul.

--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


Fri, 02 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with SQL queries in VB5

2. SQL query in VB5

3. Sql Queries ANd VB5

4. SQL query in VB5

5. SQL Queries from VB5 to Crystal Report

6. SQL-Query in VB5

7. how can I build 2 queries in 1 query(VB SQL query)

8. VB5.0 And SQL Queries....

9. VB5 DAO and SQL Queries prob

10. VB5/Access SQL query craps out in Win98 but fine in 95 and NT4

11. SQL Server queries from VB5 or 6

12. VB5 SQL Query problem

 

 
Powered by phpBB® Forum Software