Results 1 to 3 of 3

Thread: Calling Reports

  1. #1

    Thread Starter
    Member betto's Avatar
    Join Date
    Mar 2000
    Location
    Perú
    Posts
    38

    Smile

    Hi again, Im using VB5 and access 97...

    ..and I have a report made in Access which was named "REPORTE", the databasename is "SBDP.mdb"....

    I want to call this report but I got the message. "The report nbae REPORTE you entered is misspelled or refers to a report that isn't open or doesn't exist"... what is not true... the report exist!

    Code:
    Private Sub Command1_Click()
    
    Dim BD As Access.Application
    Dim MyReport As Access.Report
    
    Set BD = CreateObject("Access.Application")
    BD.OpenCurrentDatabase App.Path & "\SBDP.mdb"
    
    Set MyReport = BD.Reports("REPORTE")
    
    BD.Visible = True
    End Sub
    ..when I run the code, the aplication opens... then shows the message...
    .. what's wrong .. i think somenthing(code) is missing...

    I hope you can help me... pleeeeeeease


    betto
    [email protected]

  2. #2
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Betto

    have you tried using the docmd collection in the Access object.

    You can then call the open report method to run your report as you would do in access.
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  3. #3

    Thread Starter
    Member betto's Avatar
    Join Date
    Mar 2000
    Location
    Perú
    Posts
    38

    Cool

    Thanx... Gary..

    It really worked... and easily..

    now, it is for all of you:

    Code:
    Private Sub Command1_Click()
    
    Dim BD As Access.Application
    'Dim MyReport As Access.Report
    
    Set BD = CreateObject("Access.Application")
    BD.OpenCurrentDatabase App.Path & "\SBDP.mdb"
    
    DoCmd.OpenReport "reporte", acViewPreview  'thats it
    
    'Set MyReport = BD.Reports("reporte")
    
    'BD.Visible = True
    
    End Sub

    Thanks friends...

    betto
    [email protected]


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