Results 1 to 5 of 5

Thread: [RESOLVED] Bind data to ComboBox in Access form at Run Time ???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    152

    Resolved [RESOLVED] Bind data to ComboBox in Access form at Run Time ???

    hi all,

    i have one from on which i have number of control i have one Combobox CustomerName on my form when user select "customername" the data related to that customer is display in all control now i have one more combobox on same form i want to bind the data to this 2 nd combobox how can i do this ??

    How can i write the binddata property of combobox through code at runtime ??

    suppose code is like this ....


    is this posible ???

    select pricecode from price where customerid = "& combobox1.value &"
    if rs.BOF = false And rs.EOF = false then
    while rs.EOF
    combobox2.additem(rs("pricecode "))
    wend
    Endif

    the code which i write is just an example, is this posible ?? How ??
    additem method is not present there ....

    pls help me regarding this ...
    Last edited by nileshhthakur2004; Mar 23rd, 2006 at 02:42 AM. Reason: Change Hedding of Thread
    Nilesh Thakur.

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Bind data to ComboBox in Access form at Run Time ???

    i have one from on which i have number of control i have one Combobox CustomerName on my form when user select "customername" the data related to that customer is display in all control now i have one more combobox on same form i want to bind the data to this 2 nd combobox how can i do this ??

    How can i write the binddata property of combobox through code at runtime ??

    Hi,

    Based on my understanding, your requirement is you have a form with 2 combo boxes..when you select a customer name combo box, the second combo box will display the records corresponding to the customer name...Am I right?

    Where does binding takes place on this?

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brugge, Belgium
    Posts
    208

    Re: Bind data to ComboBox in Access form at Run Time ???

    Here's some code I use to update the source of a combo based on another combo

    Code:
    Private Sub combobox1_AfterUpdate()
    On Error GoTo errhandler
    combobox2=""
        If combobox1<> "" Then
            combobox2.RowSource = "select pricecode from price where customerid=" & CLng(combobox1) 
        Else
            combobox2.RowSource = "select pricecode from price"
        End If
        combobox2.Requery
        SysCmd acSysCmdClearStatus
        Exit Sub
    errhandler:
       SysCmd acSysCmdSetStatus, Err.Description
    
    End Sub

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    152

    Exclamation Re: Bind data to ComboBox in Access form at Run Time ???

    hi all,
    thanx for your help my problem is get solved

    thanx and regards,
    Nilesh Thakur.

  5. #5
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: [RESOLVED] Bind data to ComboBox in Access form at Run Time ???

    Hi,


    Good work...

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Posting Permissions

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



Click Here to Expand Forum to Full Width