Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    184

    Unanswered: Bind a textbox with field in ADO recordset?

    Does anybody know how to bind a textbox in Access with a field in an ADO recordset? Thank you

    I can do it sucessfully in VB where you set the datasource property and datafield property

    textbox.datasource = rs
    textbox.datafield = "FieldName"

    However in access those two properties do not exist only a controlsource property.

    Is there a way of binding the textbox in Access in a similar manner to VB using ADO (not using the Microsoft ADO Data Control 6.0) in code?

    Thanks for any help.
    In abundance of water only the fool is thirsty. Bob Marley.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    With VBA binding controls requires either a table or query (we won't talk about value lists) ... An ADO recordset is neither ... If you could dump your recordset into a temp table then you could do the binding with the RowSource property.

  3. #3
    Join Date
    Jan 2004
    Posts
    184
    Thank you for the advice, but I am trying to get around that by assigning an ADO recordset to the Forms recordsource like this:

    Private Sub Form_Load()

    Set rsTEST = New ADODB.Recordset
    rsTEST.Open "SELECT * FROM AD_Countries", CurrentProject.Connection, adOpenStatic, adLockBatchOptimistic
    Set me.Recordset = rsTEST

    Which works fine, then I assign the Forms recordset object to a control like this:

    Set ActiveXCtl5.Recordset = Me.Recordset

    and finally the I assign the textboxs field

    Text6.ControlSource = "Description"

    When I open the form, the forms default control (at the bottom of form Please see attached image) navigates fine. However the ActiveX control doesn't navigate the bound textbox (I know the control has the data as I can navigate with the recordcount and find works fine)

    My problem is how come the bound control on the form which is associated with the recordset does not reflect the ActiveX control navigation.
    Attached Thumbnails Attached Thumbnails untitled.gif  
    In abundance of water only the fool is thirsty. Bob Marley.

  4. #4
    Join Date
    Jan 2004
    Posts
    184
    Any help will be appreciated. Thank you.
    In abundance of water only the fool is thirsty. Bob Marley.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •