If you used the dataenvironment to create a SQLQuery and then bound
the datareport to that the datareport will be constrained by the SQL
Query, now if you manipulate the database and are having problems with
the data showing up in the report then try this code in the
datareport's Initialize Procedure
On Error GoTo Err
'if not open then open the recordset, needed only if the recordset has
never been initialized
'refresh data for report
'if the recordset has been opened then just refresh the data for the
This is based on an SQLQuery Called SQLAmbDisc, see how the
dataconnection designed turns it into a recordset for you. You can
also execute commands without much code, like:
and so on, also notice that there is no Refresh, it is now Requery,
although for some reason it takes Refresh, however, the recordset is
not refreshed and no error is generated. Go figure.. Henry
On Thu, 1 Oct 1998 17:47:55 +0200, "Allan Sladd"
>Hi All, I need some help with connecting my Report to the Environment. If I
>Execute a SQL-question (in the Dataenvironment, from my VB-Code) and want
>the report to show the result of the SQL-Question.... The Data report only
>shows the enire contents of my DB.
>How do I set Datareport1.Datameber to the Dataenvironment1.rsResultset ??
>I have tried all (!!) possible combinations.... nothing works :-(
>in my VB Code i can access the rsResultset and print the correct result of
>my SQL.. But I cant get the Datareport to use the rsResultset.
>I know that there is something I don't understand, but I don't know what I
>Can someone Please Help me ?