Solved

DataReport - very easy question

Posted on 2002-07-02
4
125 Views
Last Modified: 2010-05-02
Hello,

I want to print a DataReport, but the data that is printed there is NOT taken from a DB. Therefore, I don't have to specify DataSource and DataMember. However, VB requires it. How can I do that?

PS: This program doesn't use any DB file.
Please answer ASAP.

Thanks.
0
Comment
Question by:slavikn
  • 2
  • 2
4 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
In order to do that I need a DataBase file, don't I? But I don't have any DB file. Any more suggestions?
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
Comment Utility
You don't need a database. You can create a new recordset object and fill it without any database.

dim x as new adodb.recordset

with x
   .cursorlocation = aduseclient
   .cursortype = adopenstatic
   .locktype = adlockbatchoptimistic
   with .fields
      .append "F1", adinteger
      .append "F2", advarchar, 40
   end with
   .open

   .addnew
   .fields("F1").value = 1
   .fields("F2").value = "value 1"
   .update

   .addnew
   .fields("F1").value = 2
   .fields("F2").value = "value 2"
   .update
end with
0
 
LVL 1

Author Comment

by:slavikn
Comment Utility
Very good and helpful answer. Thanks.
I would use something shorter:

    ' Create a temporary Recordset
    Dim TempRS As New ADODB.Recordset
    With TempRS
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .LockType = adLockBatchOptimistic
        .Fields.Append "F1", adInteger
        .Open
    End With
    Set DataReport1.DataSource = TempRS

Thanks again.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now