CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Dataenvironment

  1. #1
    Join Date
    Aug 1999
    Posts
    4

    Dataenvironment

    Hi all,

    WinNt, VB6, DAO, Datareport
    I really don't know how to change the dataenvironment. I use table(on local drive) for data report. When I make data selection on the form, the selected data are stored in that table on local drive(i.e, data in that table is always deleted prior to copying new data). But the report does not show new data.
    Thanks in advance.
    Ken


  2. #2
    Join Date
    Jul 1999
    Posts
    20

    Re: Dataenvironment

    u might have saved the report with data.

    praba


  3. #3
    Join Date
    Aug 1999
    Posts
    4

    Re: Dataenvironment

    So, what should I do next? I don't really understand what you mean. Thanks



  4. #4
    Join Date
    Jul 1999
    Posts
    20

    Re: Dataenvironment

    Sorry for delayed reply


    Pre-Requisite
    Ms-Access 97 (not tested in previous verions)

    Create a test Access database. Create a table and a report.
    Name the report as "Report1" , in the report add a label named "Label3"
    Close access Database

    Open VB. Add a command button to the form

    Add the code given below in the module of form(Change the names where ever required)

    Run the application.

    U can c that, in the printed report the caption of label3 is "Testing"


    Regards
    Praba



    Code Snippet
    ------------

    Option Explicit
    Dim objAcc As Access.Application
    Dim objRpt As Access.Report
    Private Sub Command1_Click()

    Set objAcc = New Access.Application

    objAcc.OpenCurrentDatabase "c:\biblio97.mdb"

    objAcc.DoCmd.SelectObject acReport, "report1", True

    objAcc.DoCmd.OpenReport "report1", acViewDesign

    Set objRpt = objAcc.Reports("report1")

    objRpt("label3").Caption = "Testing"

    objAcc.DoCmd.OpenReport "report1", acViewNormal

    objAcc.DoCmd.Close
    Set objRpt = Nothing
    objAcc.CloseCurrentDatabase
    Set objAcc = Nothing

    End Sub



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured