Populating Listbox (Multiple Select) in a textbox and in a subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hexagram
    New Member
    • Feb 2007
    • 54

    #16
    i use one table in 2 different subform because my purpose
    is in one of the subform is the list of all product with no tags, then i will
    past to my new subform and still with a complete list of products with no tags
    then i will tag the product manually in the new form then save it
    so in my table i captured all the list of my product wig tag or without tag,

    is my analysis wont make any sense? would you give me another idea?

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #17
      Originally posted by hexagram
      i use one table in 2 different subform because my purpose
      is in one of the subform is the list of all product with no tags, then i will
      past to my new subform and still with a complete list of products with no tags
      then i will tag the product manually in the new form then save it
      so in my table i captured all the list of my product wig tag or without tag,

      is my analysis wont make any sense? would you give me another idea?
      I'm not sure why you need the two tables but you don't need to subform records.

      Once you add the record to the POR_Table the subform will populate automatically with the existing records.

      Just remove the code to add the records to the subform and see what happens.

      Mary

      Comment

      • hexagram
        New Member
        • Feb 2007
        • 54

        #18
        Only the Value in the Text Box will appear, but no records appearing in the subform : (

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #19
          Originally posted by hexagram
          Only the Value in the Text Box will appear, but no records appearing in the subform : (
          Try adding this to the end of the code.

          Code:
                 
          Me![JMTPORDETAILSUBFORM].Requery

          Comment

          • hexagram
            New Member
            • Feb 2007
            • 54

            #20
            Private Sub cmdtest_Click()
            Dim rs As New ADODB.Recordset
            Dim cnn As New ADODB.Connectio n
            Dim valSelect As Variant
            Dim i As Integer
            Dim sSql As String

            Set cnn = CurrentProject. Connection
            For Each valSelect In Me!List20.Items Selected
            sSql = "select * from [DR_Table] where id =" & Me!List20.ItemD ata(valSelect)
            rs.Open sSql, cnn, adOpenKeyset, adLockOptimisti c
            If rs.RecordCount > 0 Then
            Me!Company = rs!Company
            Me!Address = rs!Address
            Me!Contactperso n = rs!Contactperso n
            Me!Designation = rs!Designation
            Me!Telno = rs!Telno
            Me!Faxno = rs!Faxno
            Me![JMTPORDETAILSUB FORM].Requery
            Else
            Me!Company = vbNullString
            Me!Address = vbNullString
            Me!Contactperso n = vbNullString
            Me!Designation = vbNullString
            Me!Telno = vbNullString
            Me!Faxno = vbNullString
            End If
            Next valSelect

            End Sub


            Mary Do i put the code correctly? still no records appearing only the textbox

            Comment

            Working...