Results 1 to 6 of 6

Thread: More DB Questions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    I have a Few more DB Questions if someone would kind enough to answer them

    If I put "Cheese" in a text box, and I want it to go find the word cheese In a field and bring up the whole record; how could I do that??

    How Can I state which record to move to??

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi,Dayo321.

    There is a code, but you have to keep in mind, that text in Text box should be the same as in database field :

    Private Sub Command2_Click()
    Dim sql As String

    sql = "select * from categories where description = " & Chr(34) & Text1.Text & Chr(34)
    Data1.RecordSource = sql
    Data1.Refresh


    End Sub

    If you're not sure of the text, you should use another sql:

    sql = "select * from categories where description like " & Chr(34) & Text1.Text & Chr(42) & Chr(34)

    Chr(34) is ""
    Chr(42) is *

    Larisa

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Sorry, I misspelled you name.

    Larisa

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    Thanks, Your real knowledgable.
    My name is Evan

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    Grr..

    Another error.

    Umm.. Ok I Wrote ..

    SQL = "select * from categories where description like " & Chr(34) & Text1.Text & Chr(42) & Chr(34)
    Data1.RecordSource = SQL
    Data1.Refresh

    And It said
    "The Microsoft jet engine cannot find input table or query. Make sure it exists and the name spelled correct."

    The Dbsourse is called "General"

    Whats wrong??

  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi, Evan.

    To work with database you have to know sql.Here is link to sql tutorial: http://w3.one.net/~jhoffman/sqltut.htm

    I gave you example that will work with Northwind database. But if you are working with another db, you have to put in select statement your table name and field name.

    In my sample * means that I select all fields from table Categories.
    So table name is Categories.
    And field name is Description
    So you have to check your database, if table that you are using in select statement exists and you spelled it correctly. The same goes for field name.

    I hope you understand my explanation. English is not my native language.

    Larisa

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