CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Posts
    29

    Help with code to fill text boxes

    Hi,

    I have an address database with the Field ID as the primary key, I have managed to load by code a combo with surnames.

    What I want to do is load textboxes, such as address and suburb from the DB which correspond to the name when selected in the combo.

    Any sample of code to do this is appreciated.

    Regards,

    Alan.




  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Help with code to fill text boxes

    Use the FindFirst method with the ComboBox text in the criterion to lacate it in the recordset. Then use the Fields method to load the appropriate field into a textbox.


  3. #3
    Join Date
    Feb 2001
    Posts
    54

    Re: Help with code to fill text boxes

    Hello:

    You can try this code if you using ADO to get your DB NAME is a column number

    Private Sub Command2_Click()
    Adodc1.Recordset.Find "NAME=" & "'" & Combo1.Text & "'"

    End Sub

    Private Sub Command3_Click()
    Adodc1.Refresh
    End Sub

    I hope this answer your question. If you need more help, please reply


  4. #4
    Join Date
    Feb 2001
    Posts
    54

    Re: Help with code to fill text boxes

    Hello:

    I forgot to mention to you. To set textboxes, you set datasource to the ado or dao object and then set datafield to your field.

    Good Luck


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

Featured