How do I bind a textbox after a query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • damicomj
    New Member
    • Sep 2010
    • 34

    How do I bind a textbox after a query?

    I have one listbox and two textboxes. The listbox successfully populates with rows from a table. When the listbox is clicked, two values from that row are inserted into the textboxes.

    When one of the textboxes is edited, those values are not saved back into the table, obviously. After the listbox is clicked, I want to be able to bind the textboxes to the table. I am not sure how to do this.

    Below is my code to populate the two textboxes:
    Code:
    Private Sub lstRWASWA_AfterUpdate()
    Dim strSQL As String
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset
    
    strSQL = "SELECT RWACost, RWADescrip FROM tblRecurring WHERE RWANum = '" & Me.lstRWASWA & "';"
    
    rst.ActiveConnection = CurrentProject.Connection
    rst.CursorLocation = adUseClient
    rst.Open strSQL
    
    txtRWACost = rst("RWACost")
    txtRWADescrip = rst("RWADescrip")
    
    rst.Close
    Set rst = Nothing
    
    End Sub
  • damicomj
    New Member
    • Sep 2010
    • 34

    #2
    I ended up using queries insead. this thread can be closed.

    Comment

    Working...