Results 1 to 3 of 3

Thread: Think you're smart, then read this...

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Unhappy

    Alright....I have a database and I'm trying to make a query search the database for whatever's in the textbox. Once it finds a record, it will put each field into a designated text box....such as for First name, last name, address and so on. But it could also find multiple records for people with the same last name...I want to use the data control to scroll through those records and put each field into a textbox that relates to that field.....Thanx in advance (I've already read the Database tutorial)
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]

    AIM - DK4ever23[/b]


  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb SQL Statement

    Do you try to use the sql statement before?

    Assume you've declare the DAO database and recordset object.

    Code:
    SELECT * FROM YourTable WHERE [Last Name] LIKE '*" & Text1.Text & "'* ORDER BY [Last Name] ASC;"
    
    Set Rs = Db.OpenRecordset(sql,dbOpenSnapshot)
    While Not Rs.EOF
       Debug.Print Rs.Fields(0) & ", " & Rs.Fields(1) & ", Blah... Blah... Blah...."
       Rs.MoveNext
    Wend

  3. #3
    Junior Member
    Join Date
    Jun 2000
    Location
    Manchester, England
    Posts
    28
    I might be barking up the wrong tree here but here is how I would do it:

    Set the data controls properties to point at the table your querying.

    Set the data source property of the text box(es) to point at the data control and the data field to the relevant field.

    Before you run the app, remove the database and datasource properties of the data control, and in the form load event set the databasename property back to the data control (data1.databasename = "C:\myDB.mdb" etc...) Then when you build your query, set the recordsource property of the data control to the SQL query string and refresh the control. This should populate the control with the number of records returned and because you have data bound textboxes, the data control will update the text boxes as you scroll through the data.

    Please accept my apologies if I've misinterpreted the question/problem.
    We watch in reverence as Narcissus is turned to a flower.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width