|
-
Sep 7th, 2007, 10:23 PM
#1
Thread Starter
Lively Member
data report question
hello,
is there a way of adding a data report without requiring a data environment?
i tried doing so but it said invalid data source.
i only want the report to be stimulated from something i've entered on the report instead of from a database as my application wont be having one.
-
Sep 7th, 2007, 11:17 PM
#2
Fanatic Member
-
Sep 7th, 2007, 11:26 PM
#3
Hyperactive Member
Re: data report question
what exactly you want to do
try passing the values at run time to datareport objects
-
Sep 7th, 2007, 11:33 PM
#4
Thread Starter
Lively Member
Re: data report question
since i dont have a database, i'll pre-enter data onto the report first.
this is only for testing purposes just to give an idea on what the report would look like.
-
Sep 8th, 2007, 12:05 AM
#5
Re: data report question
Yes you can use a datareport without a dataenvironment. You just have to set the datasource at runtime.
dim rsRpt As New ADODB.Recordset
With rsRpt
' Create Recordset Fields (Columns) here
.Fields.Append "groupid", adVarChar, 12
.Fields.Append "meter", adVarChar, 12
.Fields.Append "lastread", adDouble
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With
rsRpt.AddNew
rsRpt!Groupid = "abc"
rsRpt!meter = "xyz"
rsRpt!lastread = 123.45
rsRpt.Update
End If
With rptMeterlist
' Bind the Recordset to the Report
Set .DataSource = rsRpt
.DataMember = rsRpt.DataMember
.Show vbModal
End With
set rsrpt=nothing
add the text boxes to your report and set the datafield property to the fields in the recordset and leave the datamember property blank.
-
Sep 8th, 2007, 12:11 AM
#6
Thread Starter
Lively Member
Re: data report question
this goes in the general declarations?
-
Sep 8th, 2007, 12:17 AM
#7
Re: data report question
This can go anywhere. I run alot of reports this way, usually from a command button. Just put the code in the click event.
-
Sep 8th, 2007, 12:24 AM
#8
Thread Starter
Lively Member
Re: data report question
i'm sorry but it says object not found:
Set .DataSource = rsRpt
-
Sep 8th, 2007, 12:32 AM
#9
Re: data report question
Sounds like it can't find the datareport. Have you created the datarareport? Make sure your using the correct name.
-
Sep 8th, 2007, 12:37 AM
#10
Thread Starter
Lively Member
Re: data report question
 Originally Posted by wes4dbt
Sounds like it can't find the datareport. Have you created the datarareport? Make sure your using the correct name.
what am i supposed to name it?
-
Sep 8th, 2007, 12:42 AM
#11
Re: data report question
With rptMeterlist
' Bind the Recordset to the Report
Set .DataSource = rsRpt
.DataMember = rsRpt.DataMember
.Show vbModal
End With
In this example I have a datareport named rptMeterlist. When I used the report designer I left the datasource and datamember properties blank and then I assigned them at runtime, see above.
-
Sep 8th, 2007, 12:48 AM
#12
Thread Starter
Lively Member
Re: data report question
so if i were to add textboxes, how do i put the values in?
-
Sep 8th, 2007, 12:55 AM
#13
Re: data report question
What ever you put in the recordset that you assign to the datareport.datasource will show up on the report.
-
Sep 8th, 2007, 01:06 AM
#14
Re: data report question
I attached a demo program that show how to use a data report without a dataenvironment. I hope this helps
-
Sep 8th, 2007, 07:10 AM
#15
-
Sep 8th, 2007, 10:03 AM
#16
Thread Starter
Lively Member
Re: data report question
 Originally Posted by wes4dbt
I attached a demo program that show how to use a data report without a dataenvironment. I hope this helps
thank you very much. i'll have a look at it.
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
|