Set source for grouped data at runtime 
Author Message
 Set source for grouped data at runtime

I am using a VB 6.0 Data Report with a Data Environment.  I need to set
the data source filename and password to my Access97 table in the Data
Environment at runtime.  This works fine until I try to set a group
command in the Data Environment that my report needs.  At design time I
attach to a dummy template database.  I have set up the group command
and have set my Data Report data member to it.  All that seems fine.
When I am done with designing, I clear the data source from my
connection in the Data Envir.

In my code, when I have the filename and password I need from the user,
I need to set up the connection as follows:
  Access97.TimesheetDB.Provider = "Microsoft.Jet.OLEDB.3.51"
  Access97.TimesheetDB.Properties("data source") = DataPath &
TimeDollarDB
  Access97.TimesheetDB.Properties("Jet OLEDB:Database Password") =
Password
  Access97.TimesheetDB.Open
  Access97.rsbyEmployee.Open "TimeDollars", Access97.TimesheetDB,
adOpenDynamic, adLockOptimistic

This code works fine without data grouping and when I change the
rsbyEmployee recordset to rsTimesheet, the ungrouped recordset.

I am getting error 3219 "The operation requested by the application is
not allowed in this context." on the .Provider line of the code.

What do I need to do differently to set the data source at runtime when
I add a group command to my Data Environment connection?

Thanks in advance.
Lisa

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Wed, 09 Jan 2002 03:00:00 GMT  
 Set source for grouped data at runtime
Try and see if the following works:

Access97.TimesheetDB.ConnectionString = _
    "Provider=MSDataShape.1;Persist Security Info=False;Data Source=" _
            & DatabaseFileName & ";Data Provider=Microsoft.Jet.OLEDB.4.0"

This is because grouping requires using MSDataShape as the OLE DB provider
since you are returning a form of hierarchical recordset.

Quote:

> I am using a VB 6.0 Data Report with a Data Environment.  I need to set
> the data source filename and password to my Access97 table in the Data
> Environment at runtime.  This works fine until I try to set a group
> command in the Data Environment that my report needs.  At design time I
> attach to a dummy template database.  I have set up the group command
> and have set my Data Report data member to it.  All that seems fine.
> When I am done with designing, I clear the data source from my
> connection in the Data Envir.

> In my code, when I have the filename and password I need from the user,
> I need to set up the connection as follows:
>   Access97.TimesheetDB.Provider = "Microsoft.Jet.OLEDB.3.51"
>   Access97.TimesheetDB.Properties("data source") = DataPath &
> TimeDollarDB
>   Access97.TimesheetDB.Properties("Jet OLEDB:Database Password") =
> Password
>   Access97.TimesheetDB.Open
>   Access97.rsbyEmployee.Open "TimeDollars", Access97.TimesheetDB,
> adOpenDynamic, adLockOptimistic

> This code works fine without data grouping and when I change the
> rsbyEmployee recordset to rsTimesheet, the ungrouped recordset.

> I am getting error 3219 "The operation requested by the application is
> not allowed in this context." on the .Provider line of the code.

> What do I need to do differently to set the data source at runtime when
> I add a group command to my Data Environment connection?

> Thanks in advance.
> Lisa

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Thu, 10 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting Data Definition file data source at run time

2. Create Single Data Set from mulitple data sources

3. set text file location (source) runtime

4. setting the odbc source runtime

5. setting the source of a subreport at runtime?

6. Data Report and Grouping at Runtime

7. Stopping data from being grouped by Group 1 when that group is suppressed

8. Creating an ODBC Data Source at Runtime

9. changing data source in crystal report @ runtime

10. Crystal/ASP: Passing Data Source at runtime

11. Change ODBC Data Source at runtime

12. Using Runtime Data Sources with Oracle

 

 
Powered by phpBB® Forum Software