Results 1 to 4 of 4

Thread: MS Access Tables

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Reading,Berkshire,England
    Posts
    1

    Post

    I currently have a value in a text box tht I need to search for in a table, but i do not seem to be able to get the button on the form to take this value and search through the table i have created for the specific value. Any suggestion?

    Cheers in advance

    Andrew

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Galway, Ireland
    Posts
    316

    Post

    If your text box is text1 and the field name is a_number then open the database (eg table1) and do the following

    table1.findfirst "a_number = " & text1.text

    to test if it has found it use table1.nomatch which will be true if it does not find it.
    Is this y9our answer???

    [email protected]


  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Galway, Ireland
    Posts
    316

    Post

    Here is an example I use to logon (put the text in the click event of the command button

    dim logon_data as recordset


    Set logon_data = bar_data.OpenRecordset "users", dbOpenDynaset)
    findstring = "user_no = '" & Text1.Text & "'"
    logon_data.FindFirst findstring
    If logon_data.NoMatch Then
    MsgBox ("User does not exist")
    Text1.Text = ""
    user.Text = ""
    Else
    OK TO DO SOMETHING

    endif

  4. #4
    Addicted Member
    Join Date
    Jan 1999
    Location
    Sydney,NSW,Australia
    Posts
    178

    Post

    So txtText1 and cmdBtn and rsData
    Your users enter a string to txtText1 and click cmdBtn to do a search for say name in rsData

    Private cmdBtn.Clink....
    '
    ' Test user entered something
    '
    If len(trim(txtText1)) > 0 then
    rsData.FindFirst("Fieldname = '" & txtText1 & "'")
    if rs.nomatch then
    .
    else
    data found do whatever
    end if
    .
    .
    You can shorten this with the use of SQL to do a complete sweep of the recordset. If you want an example email me at [email protected]

    Hope it helps

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