ADODC control in a ADO Coded form

ADODC control in a ADO Coded form

Post by Mike Sherr » Wed, 30 Dec 1998 04:00:00



Greetings,

I have a form (generated ADO code using the Wizard) to work with a table
in ACCESS.

I needed to add another table (for lookup reference) to this form, since
I didn't want to mess with the generated code/set procedures, I added a
ADO control.  This is where it becomes difficult.  The control is to
look out to another table and retrieve the "codes" the user is allowed
based on the category the user selects.

In example:
There are two combo boxes, in the first combo box are the hard coded
CATEGORIES that the user selects from.  After selecting one of the
Categories the user then goes to the second combo box and selects the
CODE from the list of available Codes in the Category.

This is the problem:
The SQL to retrieve the "Codes" is dependant on the String value that
contains the Category.  The SQL code is typed into the Property Page,
obtained by clicking the Row Source Item of the ADODC, does not deal
with quotes hence, can not obtain a string value.  The Row Source is
needed to tell the ADODC where to obtain it's information from.

If I haven't made this too vague or complex, any help is greatly
appreciated

Mike

 
 
 

ADODC control in a ADO Coded form

Post by Mike Waldma » Fri, 01 Jan 1999 04:00:00


Mike -

If you are trying to set the recordsource of the ADODC control in code -
this is how I did it -

strSQL = "Select [code] from [tbl] where category = " & cboCategory

With adodc
    .CommandType = adCmdText
    .RecordSource = strSQL
    .Refresh
End With

Mike


>Greetings,

>I have a form (generated ADO code using the Wizard) to work with a table
>in ACCESS.

>I needed to add another table (for lookup reference) to this form, since
>I didn't want to mess with the generated code/set procedures, I added a
>ADO control.  This is where it becomes difficult.  The control is to
>look out to another table and retrieve the "codes" the user is allowed
>based on the category the user selects.

>In example:
>There are two combo boxes, in the first combo box are the hard coded
>CATEGORIES that the user selects from.  After selecting one of the
>Categories the user then goes to the second combo box and selects the
>CODE from the list of available Codes in the Category.

>This is the problem:
>The SQL to retrieve the "Codes" is dependant on the String value that
>contains the Category.  The SQL code is typed into the Property Page,
>obtained by clicking the Row Source Item of the ADODC, does not deal
>with quotes hence, can not obtain a string value.  The Row Source is
>needed to tell the ADODC where to obtain it's information from.

>If I haven't made this too vague or complex, any help is greatly
>appreciated

>Mike


 
 
 

1. ADO Newbie: How to code a one to many relationship form with ADODC controls

I'm attempting to implement a rather simple form in VB6 with a one to many
relationship between Table A and Table B (e.g. Customers and Orders). The
backend DB is Access 2002 and the connection provider is Jet 4. I have an
ADODC to navigate through Customers and fill in corresponding data-bound
textboxes. This works fine. I have a DataGrid with a second ADODC that uses
a separate connection and a command RecordSource of "Select * from Orders
where customerid = '" & CustomerIdTextbox.Text & "'". I reset the
RecordSource of the Orders ADODC within the MoveComplete handler of the
CustomerADODC. This works fine.

But, if a Customer has no Orders, then the OrdersADODC won't allow me to add
new Orders records from within the DataGrid. What additional event handlers
need to be written and which default ADODC properties need to be changed?

Forgive me my ignorance - I've studied the included online help and some
Internet faq material but haven't yet stumbled over an answer to this
seemingly common pattern...

Oh, I don't believe I want a FlexGrid because the Customer information isn't
presented in table format. But, maybe I'm wrong. Perhaps the FlexGrid
control has the logic to handle multi-table recordsets even if one isn't
presenting everything in grids...

Thank you,
Lonnie VanZandt

2. mdac 2.6

3. Bind an ado recordset directly to an ado data control (adodc)

4. Linked server queries

5. ADO code generated recordset and binding to form controls

6. Problem in error message

7. cannot initialize adodc control from the code

8. How to put a Form parameter in Adodc Control Record Source property

9. Strange ADODC ActiveX Data Control (ADO) DataControl Error

10. Bound controls not updating ADO with adodc.recordset.update command

11. Data bound controls using Adodc and ADO connection object

12. ADO Data Control/ADO Code or Class?