[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Manually adding details to a Data Report

Posted on 2004-11-24
4
Medium Priority
?
188 Views
Last Modified: 2010-05-02
Hi,

I'm trying to dump some simple data on a datareport.

I don't want to have to connect to a database or any datasource at all if i can.
just want to use the pretty's of the report layout and manually post some data to it.

Help!
0
Comment
Question by:benspan
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
ajgilbert earned 200 total points
ID: 12674373
You can do this, but it requires some fiddling about. The first thing is that the datareport must be attached to a datasource - this is a limitation of the datareport itself. The way round this is to

Create a dataenvironment command which only retrieves 1 record - you can do this by setting the max records property (on the advanced tab of the command properties window).

Alternatively, you can create the datasource within your code, and populate it with a single record. The thing to remember is that data is irrelevant, we are only using it to get around the datareport limitation.

Assign this datasource to your datareport

Add labels onto the report itself. We need to use labels to contain the report information as text boxes can only be populated from a data source.

You can then populate the labels from your code. In the example below, I have set up 6 labels (3 in the report heading, 2 in the report body)....


With DataReport11.Sections("Section2")                         ' Report header
    .Controls("Label1").Caption = "Surname"
    .Controls("Label2").Caption = "Forename"
    .Controls("Label3").Caption = "Title"
End With

With DataReport15.Sections("Section1")                        ' Report body
    .Controls("Label4").Caption = "Smith"
    .Controls("Label5").Caption = "John"
    .Controls("Label6").Caption = "Mr"
End With

DataReport1.Visible = True

Hope this helps


0
 
LVL 5

Expert Comment

by:ajgilbert
ID: 12674385
Sorry, datareport15 above should be datareport1.
0
 

Author Comment

by:benspan
ID: 12677835
Awesome,

Is it possible to not have a datasource?
0
 
LVL 5

Expert Comment

by:ajgilbert
ID: 12679498
Hi Benspan,


No, you must have a datasource, if you don't then the datareport will error when you run it.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question