Results 1 to 2 of 2

Thread: selecting data from a database

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 1999
    Posts
    2
    I have an access database containg customer name, number and address.

    When I enter the name PRICE, I want the code to search the database, offer me all the PRICEs so I can see if I'm entering a new customer or an existing customer. If its an existing customer I want to be able to then select that customer from the list an use the existing address and customer name to populate my new entry.

    Any help out there?

    Thanks

    Bern

  2. #2
    Member
    Join Date
    Jun 2000
    Posts
    34
    Are you using VB, if you are here's some help, otherwise I can't help you,

    Use a textbox to enter the cutomers name, have a data bound listbox with a Data control bound to it and three textboxes to store the data with a Data control bound to them, then use the following code:

    Data1.Recordsource = "SELECT CustomerName, Number, Address FROM CustomersTable WHERE CustomerName = '" & Text1.Text & "'"

    Make sure your listbox listfield is set to CustomerName. Then in the Click event of the listbox use the following code:

    Data2.Recordset.FindFirst "CustomerName = '" & DBList.Text & "'"

    This will fill your text boxes with the information you selected.


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