Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DataReport - very easy question

Posted on 2002-07-02
4
128 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 70

Expert Comment

by:Éric Moreau
ID: 7124450
0
 
LVL 1

Author Comment

by:slavikn
ID: 7124609
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 70

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 7124657
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
ID: 7124802
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

856 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