Results 1 to 6 of 6

Thread: Database Programming

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    131

    Database Programming

    Ok. Here is my problem.

    I need to have the user perform a search (eg. last name).
    Let's say they type in smith as the last name. I got this part ok, what I want is if there are 5 smiths, they can choose one and go to the customer properties to change information.

    So my question is, what is the best control to use to retrieve search data and allow the user to click on the desired result and have the customer properties open with all the customer information?
    Things fall apart which the center cannot hold...

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Database Programming

    There aint any controls for that purpose - you'd have to code it yourslef.
    General idea is as follows:
    - open connection
    - construct sql statement such "Select * From Customers Where Last_Name Like 'Smit%'"
    - open recordset based on your sql
    - populate all necessary controls (grid, textboxes, etc ...)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    131

    Re: Database Programming

    what i am getting at is, after running a query and populating the datagrid with the results, how do i populate text boxes based on what result was clicked on from the datagrid.
    Things fall apart which the center cannot hold...

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Database Programming

    Which datagrid are you using? There are two: one is Data Bound Grid (DBGrid) and second is Data Grid (DataGrid).

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    131

    Re: Database Programming

    DataGrid
    Things fall apart which the center cannot hold...

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Database Programming

    Oh, ok. In that case all you'll need to do (after search is completed) is something similar to the following:
    VB Code:
    1. Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    2.     Text1.Text = Adodc1.Recordset!ID
    3. End Sub

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