Search an Access DB backend using a VB6 front end 
Author Message
 Search an Access DB backend using a VB6 front end

Hi all

I could do with a serious answer for somthing I am doing for my uni project.
I am writing a small VB program that interacts with a Access database
backend.  I want to be able to search the database but I have got no idea
how to do it.  All i want to use is a text box to enter the search criteria
in and a command btn to activate the search.  The record can just be
displayed in the main form where you would enter the data.

Please can someone help me

Thanks
Andy



Tue, 06 Sep 2005 07:44:50 GMT  
 Search an Access DB backend using a VB6 front end


Quote:
> Hi all

> I could do with a serious answer for somthing I am doing for my uni project.
> I am writing a small VB program that interacts with a Access database
> backend.  I want to be able to search the database but I have got no idea
> how to do it.  All i want to use is a text box to enter the search criteria
> in and a command btn to activate the search.  The record can just be
> displayed in the main form where you would enter the data.

> Please can someone help me

> Thanks
> Andy

Your question may be more complex than you imagine. The text box that
you mention. What is it's value going to be compared with? Do you
envision a way to enter an item's ID value and then find that item, or
do you want a more generic area where the user can enter a search
criteria (much more difficult unless you want to assume the user knows
SQL).

Assuming you are using an SQL statement to grab the record you want, and
assuming you know how to display the results once you have them...

dim conn as ADODB.Connection
dim rs as ADODB.Recordset
dim SQL as string

' assuming a numeric RecordID
SQL = "SELECT * FROM table WHERE RecordID = " & textbox1.text
' assuming a text RecordID
' SQL = "SELECT * FROM table WHERE RecordID = '" & textbox1.text & "'"

' Do your connection object stuff here (connect to the database)
Set conn = new ADODB.Connection
conn.open "blah blah blah"
set rs = conn.Execute(SQL)

if rs.eof then
        ' Record not found
else
        ' Populate textboxes, etc with values found
        textbox2.text = rs("FieldName")
end if

set rs = nothing
set conn = nothing

set rs =

--

Remove NOT from email address to reply. AntiSpam in action.



Tue, 06 Sep 2005 10:15:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Front end in Access 2000 / backend in access 97

2. Access97 backend with VB6.0 front ends?

3. Using VB6 As A Front-End on A Linux DB

4. VB6 (ADO) Front end to MS Access DB on Network Drive

5. Linking multiple Access backends with a single front end

6. Using unbound forms to speed up front/back end access db

7. Backend or front end trigger in database?

8. How I Can Put my image from front end vb to backend sql server

9. Splitting db in front end and back end

10. VB Front end dll loses connection to back end SQL server db after an hour

11. ASP User wants to create VB Front-end for Access DB

12. VB6 front end to Access/SQL Server

 

 
Powered by phpBB® Forum Software