Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Try to set values of a text box thru code

    I try to to set the value of a text box through code and it will always display the same value in every record. I think i cant display a recordset in a text box. What way i use so that i can display my values in the text box.

    Private Sub Form_Open(Cancel As Integer)
    Dim qry As String, rst As Object
    qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology INNER JOIN tbl_events ON tbl_events.TicketNum=tbl_EquipmentChronology.Ticke tNum where tbl_events.TicketNum=" & Forms!tbl_PPVResearch_Edit!frm_Events!TicketNum & " and tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.O utlet"
    Set rst = CurrentDb.OpenRecordset(qry)
    rst.MoveFirst
    Do While Not rst.EOF
    Forms!tbl_PPVResearch_Edit!frm_Events![Text2] = rst!Equipment1
    rst.MoveNext
    Loop
    End Sub

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Well the code you have there will display only the last record's value ... What kind of form is this? Continuous? Is the textbox bound? If so, to what? Since you express a desiree multiple items, why not use a combobox?
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jul 2006
    Posts
    157
    This is a continuous form and the textbox is not bound as i need only for display.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by mustish1
    This is a continuous form and the textbox is not bound as i need only for display.
    That explains it then ... Controls MUST BE BOUND in a continuous form in order to display row based data. Setting your RowSource will do this for you ... How to get the data thru code? Do as before except write the data into a temporary table that you bind the textbox to ... And this concept has been posted on many times by many folks here ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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