Re: VB Listbox?



Mitchel wrote:
On Mar 11, 1:11 am, "Bob Butler" <no...@xxxxxxxxxxx> wrote:
"Mitchel" <Stratl...@xxxxxxxxx> wrote in message

news:58041163-862c-4f47-95c9-2b2b1a5fa8e6@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 11, 12:31 am, "Bob Butler" <no...@xxxxxxxxxxx> wrote:





"Mitchel" <Stratl...@xxxxxxxxx> wrote in message
news:9c73fbbb-454f-4783-9b13-6946836d358b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have created an Access DB Query( Client names) and have a VB6 Form
frontend. I need to create a search using a Textbox and Listbox, where
I type into the Textbox and the results from the query are returned in
the listbox. How do I do this??
22 minutes ago
What part are you having trouble with?
opening the database?
running the query?
loading the listbox?
15 minutes from now
Yeh I just dont know what code to use?
I've created an ADO and connected it to the query, but i dont know how
to populate the list?
"created an ADO"? Do you mean an ADO data control? Connected to the query
how?

I just need a good front end that I can search the database by
firstname, lastname of ID(autonumber).
You probably need to post some code of what you have tried already. Your
code should look something like

dim DB as adodb.connection
dim RS as adodb.recordset
set db=new connection
db.open "whatever the connection string is for your database"
set rs=db.execute("select thefield from thetable where thefield like '%" & _
replace(text1.text,"'","''") & "'")
list1.clear
do until rs.eof
list1.additem "" & rs.fields("thefield").value
rs.movenext
loop
rs.close
db.close- Hide quoted text -

- Show quoted text -

What is a connection string or how do I find it for my database?

I see Ralph is still around answering queries, but he must have missed yours.
The connection string would be

"Provider=Microsoft.jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\db\mitchel\documents\mydata.mdb"

(All on one line. Try it with your database location and name, though)

If it bombs out, reply with the version of access you're using

Graham




.



Relevant Pages

  • Re: Help - Cant understand Code
    ... Listbox with MultiSelection used in Query ... I have the sample database in its orignial form. ... The subform doesn't have a SELECT statement however the query it is bound ...
    (microsoft.public.access.forms)
  • Re: ASP Newbie question
    ... The name of the database file is Guestbook.mdb. ... 'This creates an instance of an ADO Connection object. ... 'The Open method of the Connection object uses the connection string to ... 'This query will add your data into the database, ...
    (microsoft.public.inetserver.asp.general)
  • a special type of search form
    ... The list of all records you saw was probably a ListBox. ... Private Sub List1_DblClick ... You can also set criteria in your query based on values on ... >the form would be a list of every record in the database, ...
    (microsoft.public.access.forms)
  • populate a texbox using selection from listbox
    ... I will apologize first if this is longwinded here is my situation. ... I set the database up as ... for ease of use i created a combo box which uses a query to populate ... the comment associated with the part selected in the listbox, ...
    (microsoft.public.access.formscoding)
  • Re: DataGrid / DataSet Issue
    ... The connection string is where I went wrong. ... Microsoft Excel to connect to the database where I chose the tables I ... needed and then ran a query to get the data I wanted- after which I ... appearing to be master tables, were not master tables at all. ...
    (microsoft.public.dotnet.languages.vb)