Send an ADODC to another Form
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Send an ADODC to another Form

  1. #1
    Join Date
    Mar 2013
    Posts
    1

    Question Send an ADODC to another Form

    Backgoroud:
    I have a form "frmSearch", it contains an ADODC, multiple comboboxes and a text box infront of each combo box. Here is a picture of that.

    Name:  FrmSearch.PNG
Views: 151
Size:  17.1 KB

    The form will use an ADODC to full combobox with all the available fields in that ADODC, and the combobox together with textbox infront of it will narrow down records in adodc according to search criteria

    I've got multiple forms that contain multiple ADODCs each. Usually 2 or 3 ADODC each.
    They all load the form "frmSearch" when the button "cmdSearch" is clicked. I want to send a specific adodc in from each form to "frmSearch", so it can fill the combo boxes.

    Problem:
    The problem I'm having is how will the "frmSearch" know which ADODC in a form to alter. The form "FrmCustomer" contain 2 ADODCs, "adoCustomer", and "adoCustomerContact". I can't just do the following and use the variable to access that particular ADODC.

    (Form Customer)

    Code:
    Public ADO as string
    
    Private Sub Command1_Click()
    ...
    ADO = adoCustomer.name
    ...
    End Sub

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,844

    Re: Send an ADODC to another Form

    You really should not be using the ADODC. Bound controls are not such a good idea either. Much better to use code instead for several reasons.

    As for passing something to another form you do it by passing it as a parameter. Create a sub routine on your form that accepts the object as a parameter and then pass that object. Or you can reference the actual data control by using the name of the form and the control. ie. FrmCustomer.adoCustomer


    Though here I am not sure why you would need to send a data control.
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center