Results 1 to 8 of 8

Thread: Problem with calling Access Report from VB

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Problem with calling Access Report from VB

    Hey,

    I have a report in Access that I am opening from VB using the access object reference. For some reason when I originally open it to preview from the VB app it shows no data. If I go into design and back to preview the data appears. If I just open the DB manually and double click the report the data shows up. Anyone know what might cause the data not to appear upon originally opening the report through VB?

    Thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with calling Access Report from VB

    Weird issue. What and where is the recordseource for the report? Are you using any filters? Can you post some of the code you use to open your report? What version of Access?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Problem with calling Access Report from VB

    The recordsource is straight from a table in Access 2000. There are no filters but I did set the report to sort by one of the columns.

    Here is the VB code I use to call it:

    [Highlight=VB]
    Set acAPP = New Access.Application
    acAPP.OpenCurrentDatabase App.Path & "\reporting.mdb"
    acAPP.Visible = True
    acAPP.DoCmd.OpenReport "Report_Name", acViewPreview
    acAPP.DoCmd.Maximize
    [\vbcode]

    I use the same exact code to call a few other reports that work fine. The only thing is the other reports pull data from queries instead of a table.

  4. #4
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Problem with calling Access Report from VB

    As RD has alreadt stated.. wierd Issue..

    Could you try replacing the table name in the RecordSource of the report to a "SELECT * FROM tableName ORDER BY FieldName" instead and see if that resolves it.

    It could be that the code is executing too quickly for the database to open the table's data, doubt this is it but worth a shot..
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Problem with calling Access Report from VB

    Thanks for the suggestion... tried it but was unsuccessful.

  6. #6
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Problem with calling Access Report from VB

    Another shot in the dark.. but have seen this issue with some of my own reports...

    Check the printer that the report is assigned to.

    What version of Access and operating system are you on?
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Problem with calling Access Report from VB

    I am just previewing the report, so I don't think the printer should matter. I am using Access 2000 on Win XP.

  8. #8
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Problem with calling Access Report from VB

    Believe it or not it will matter.. if the default printer that the report is linked to is unavailable it will not display.

    in fact this is what I stumbled across when I started experiencing report problems on Win XP..

    Default Printers in Office 2000
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

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