?
Solved

DataReport - very easy question

Posted on 2002-07-02
4
Medium Priority
?
131 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
[X]
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
  • 2
  • 2
4 Comments
 
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 200 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

764 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