|
-
Dec 14th, 2007, 01:57 AM
#1
Thread Starter
Addicted Member
Datareport Grouping Problem
Hi all
Hope to hear you fine both mentally and physically
Here is a new problem for you:
I am creating an inventory software. The software requires to keep track of all transactions of each fiscal year. Now I am creating database named as 2007-2008.mdb for fiscal year 2007-2008, 2006-2007.mdb for fiscal year 2006-2007 etc. The database contains the fields like stockgroup,stockitem, qty etc.
Suppose the user wants to know the transactions done in the year 2006-2007group by stockgroup. So I need to connect my dataenvironment to the database 2006-2007 which I am doing thru the code :
1 Code:
DataEnvironment1.ConnectionString"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\" & Trim(ipAddr) & "\BCRSTUDENT\" & Trim(fold) & Trim("\") & Trim(fold) & ".mdb;Persist Security Info=False"
DataEnvironment1.Connection1.Open
DataEnvironment1.rsCommand1_Grouping.Open "SHAPE {select * from stock } AS Command1 COMPUTE Command1 BY 'stockgroup'"
DataEnvironment1.rsCommand1_Grouping.Requery
DataReport1.Show
ipaddr is the ip address of the server where the database is locatedcentrally. and fold is tracking which fiscal year i.e fold may be 2006-2007 or 2007-2008 or like that
Now when I am showing the report for the first time it is fine.
in the QueryClose event of the DataReport i am using the code :
1 Code:
DataEnvironment1.Connection1.Close
When I am trying to show the record second time I am getting the Run Time Error '3709' stating
"This connection cannot be used to perform the operation. It is either closed or invalid in this context"
Can u help me out regarding this problem
Please help me
Thanx in advance
Regards
Arghya
Last edited by jobs_arghya; Dec 14th, 2007 at 05:05 AM.
-
Dec 14th, 2007, 03:01 PM
#2
Re: Datareport Grouping Problem
Do you have to close the connection? Why not close the rsCommand1_Grouping
Code:
if rsCommand1_Grouping.State = adStateOpen then rsCommand1_Grouping.Close
DataEnvironment1.rsCommand1_Grouping.Open "SHAPE {select * from stock } AS Command1 COMPUTE Command1 BY 'stockgroup'"
DataEnvironment1.rsCommand1_Grouping.Requery
DataReport1.Show
You can set the connectionstring in the dataenviroment_initialize event
Last edited by wes4dbt; Dec 14th, 2007 at 03:15 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|