Solved

DataReport - very easy question

Posted on 2002-07-02
4
126 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
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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

862 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

30 Experts available now in Live!

Get 1:1 Help Now