PDA

Click to See Complete Forum and Search --> : DED, report designer, & setting recordsets


P.S.W.
Aug 8th, 2000, 01:18 PM
Hi everybody!

I am trying to create a program that will create reports using a range of data that the user specifies. I am using the DED and Data Report Designer.

My problem is this: I have a pop-up form collect the range of dates for preparing the report, and then I try to reset the SQL statement for the appropriate command object/recordset using those dates, then show the report. I can't figure out how to make it work.

First off, the DED recordsets don't support a "refresh" method. Also, after changing the .Source property to reflect the modified SQL, the report still prints out -all- the dates. If anyone can help me with the steps/code necessary to make this work I would be grateful.

Nathan
Aug 8th, 2000, 02:20 PM
Try this... set up the command in the dataenvironment to return a recordset and use two parameters (ie. your two dates). then when you have the two dates open the command using the two input dates as the parameters. Then open the report.

If you need more help or if any part of this is unclear let me know.

P.S.W.
Aug 8th, 2000, 03:31 PM
Nathan,

Thanks for your help. I've been looking through my DB books and I think I have a handle on creating a parameterized query in SQL --however-- I'm a little fuzzy on how to pass the parameters to the command object using code. Do you (or anybody out there) know how to do this using ADO/DED recordset?

Nathan
Aug 8th, 2000, 04:00 PM
To pass parameters to your command through code works like this

DataEnvironment1.Command1 parm1, parm2, parm3

etc...

Let me know if it works or not or if you need more help.

P.S.W.
Aug 9th, 2000, 12:53 PM
Nathan,

You da man!! It works great! Thanks, pal :).

I only have one more question (I know, I ask too much!)

My code now looks like this:

DataEnvironment1.Command1 StartDate, EndDate
Report1.Visible = True

Which now works perfectly --except-- when I try to run this same procedure a second time, it gives me Error 3705 "Operation requested not allowed if object is open"

So clearly, I have to somehow close or reset the command before trying to create another report with it. I've been fooling around with the closing the recordset and some other stuff, but so far everything I've tried causes only more errors :(. Any ideas on the proper way to do this? Thanks again for your previous replies.