dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Fill Up A Combo Box At Run Time

  1. #1
    Ariel Guest

    Fill Up A Combo Box At Run Time


    this is what i have but it doesn't work...Please Help!

    If rs1.RecordCount > 0 Then
    rs1.MoveFirst
    Do Until rs1.EOF
    Me.cboFacilities.ColumnCount = 2
    Me.cboFacilities.BoundColumn = 0
    Me.cboFacilities.Column(0, i) = rs1("FacilityID")
    Me.cboFacilities.Column(1, i) = rs1("FacilityName")
    i = i + 1
    rs1.MoveNext
    Loop
    Else
    'EmptyFields
    lblRecInfo.Caption = "No Records Available!"
    End If

    Thank you!

  2. #2
    Joe \Nuke Me Xemu\ Foster Guest

    Re: Fill Up A Combo Box At Run Time

    "Ariel" <arodrig8@mdcc.edu> wrote in message <news:3d4eb9c6$1@10.1.10.29>...

    > this is what i have but it doesn't work...Please Help!


    Well, what's wrong with it, exactly?

    > If rs1.RecordCount > 0 Then


    Some cursor types always return -1 for RowCount.

    > rs1.MoveFirst


    Some cursor types (the faster ones!) also don't like MoveFirst.

    > Do Until rs1.EOF
    > Me.cboFacilities.ColumnCount = 2
    > Me.cboFacilities.BoundColumn = 0


    Surely you don't need to set the column count and binding info
    more than once?

    > Me.cboFacilities.Column(0, i) = rs1("FacilityID")
    > Me.cboFacilities.Column(1, i) = rs1("FacilityName")


    Don't you need to tell the combo about the new row first? Just
    what kind of "combo box" is this, anyway?

    > i = i + 1
    > rs1.MoveNext
    > Loop
    > Else


    You could just use the value of i to tell you if there were any
    rows or not.

    > 'EmptyFields
    > lblRecInfo.Caption = "No Records Available!"
    > End If


    --
    Joe Foster <mailto:jlfoster%40znet.com> "Regged" again? <http://www.xenu.net/>
    WARNING: I cannot be held responsible for the above They're coming to
    because my cats have apparently learned to type. take me away, ha ha!



  3. #3
    ariel Guest

    Re: Fill Up A Combo Box At Run Time


    It's an Access Combo box!

    "Joe \"Nuke Me Xemu\" Foster" <joe@bftsi0.UUCP> wrote:
    >"Ariel" <arodrig8@mdcc.edu> wrote in message <news:3d4eb9c6$1@10.1.10.29>...
    >
    >> this is what i have but it doesn't work...Please Help!

    >
    >Well, what's wrong with it, exactly?
    >
    >> If rs1.RecordCount > 0 Then

    >
    >Some cursor types always return -1 for RowCount.
    >
    >> rs1.MoveFirst

    >
    >Some cursor types (the faster ones!) also don't like MoveFirst.
    >
    >> Do Until rs1.EOF
    >> Me.cboFacilities.ColumnCount = 2
    >> Me.cboFacilities.BoundColumn = 0

    >
    >Surely you don't need to set the column count and binding info
    >more than once?
    >
    >> Me.cboFacilities.Column(0, i) = rs1("FacilityID")
    >> Me.cboFacilities.Column(1, i) = rs1("FacilityName")

    >
    >Don't you need to tell the combo about the new row first? Just
    >what kind of "combo box" is this, anyway?
    >
    >> i = i + 1
    >> rs1.MoveNext
    >> Loop
    >> Else

    >
    >You could just use the value of i to tell you if there were any
    >rows or not.
    >
    >> 'EmptyFields
    >> lblRecInfo.Caption = "No Records Available!"
    >> End If

    >
    >--
    >Joe Foster <mailto:jlfoster%40znet.com> "Regged" again? <http://www.xenu.net/>
    >WARNING: I cannot be held responsible for the above They're coming

    to
    >because my cats have apparently learned to type. take me away,

    ha ha!
    >
    >



  4. #4
    Arthur Wood Guest

    Re: Fill Up A Combo Box At Run Time


    Ariel,
    two things:

    1) you asked this SAME question in the vb.vba discussion group (which is
    where it BELONGS, as you are asking about VBA - Access coding is VBA NOT
    VB) - look at my answer there.

    2) Please DO NOT double-post (also called cross-posting) the SAME question
    is two or more discussion groups. It is considered to be VERY RUDE.

    Arthur Wood


    "ariel" <arodrig8@mdcc.edu> wrote:
    >
    >It's an Access Combo box!
    >
    >"Joe \"Nuke Me Xemu\" Foster" <joe@bftsi0.UUCP> wrote:
    >>"Ariel" <arodrig8@mdcc.edu> wrote in message <news:3d4eb9c6$1@10.1.10.29>...
    >>
    >>> this is what i have but it doesn't work...Please Help!

    >>
    >>Well, what's wrong with it, exactly?
    >>
    >>> If rs1.RecordCount > 0 Then

    >>
    >>Some cursor types always return -1 for RowCount.
    >>
    >>> rs1.MoveFirst

    >>
    >>Some cursor types (the faster ones!) also don't like MoveFirst.
    >>
    >>> Do Until rs1.EOF
    >>> Me.cboFacilities.ColumnCount = 2
    >>> Me.cboFacilities.BoundColumn = 0

    >>
    >>Surely you don't need to set the column count and binding info
    >>more than once?
    >>
    >>> Me.cboFacilities.Column(0, i) = rs1("FacilityID")
    >>> Me.cboFacilities.Column(1, i) = rs1("FacilityName")

    >>
    >>Don't you need to tell the combo about the new row first? Just
    >>what kind of "combo box" is this, anyway?
    >>
    >>> i = i + 1
    >>> rs1.MoveNext
    >>> Loop
    >>> Else

    >>
    >>You could just use the value of i to tell you if there were any
    >>rows or not.
    >>
    >>> 'EmptyFields
    >>> lblRecInfo.Caption = "No Records Available!"
    >>> End If

    >>
    >>--
    >>Joe Foster <mailto:jlfoster%40znet.com> "Regged" again? <http://www.xenu.net/>
    >>WARNING: I cannot be held responsible for the above They're coming

    > to
    >>because my cats have apparently learned to type. take me away,

    >ha ha!
    >>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center