Results 1 to 6 of 6

Thread: Don't want Access window.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80

    Question

    Hi,

    I'm using the following code in VB5 to open an Access 97 report(acPreview).

    I'm then immediately using the OutputTo method from Access to create an HTML page from the report.

    Does anyone know how I can stop Access opening in it's own window?

    'Declare the variable
    Dim appAccess As Access.Application

    'Create a new access application
    Set appAccess = New Access.Application

    'Open the database
    appAccess.OpenCurrentDatabase _
    "G:\Wiz Add Ins\Energy Client\Database\Energy Client.mdb"

    'Open the report
    appAccess.DoCmd.OpenReport "rptStatement", _ acViewPreview, , "[Date] = #" & datReportDate & "#"

    'Output the statement report to an HTML file
    appAccess.DoCmd.OutputTo acOutputReport, "rptStatement", _ acFormatHTML, _
    "G:\Wiz Add Ins\Energy Client\HTM\Statement.Htm"

    'Close access
    appAccess.Quit

    Any suggestions would be greatly appreciated,

    Best regards,

    Rob Brown.

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Access Window

    Rob,

    Try turning screen painting off before opening the access app and then setting the Application.Visible property to false, then repaint the screen.

    Code:
    Me.AutoRedraw = False
    appAccess.Visible = False
    Me.AutoRedraw = True
    BTW Why are you previewing the report? There is no 'get-out' to cancel the file creation - you can just do that in one step.

    Cheers,

    Paul

    [Edited by paulw on 10-30-2000 at 10:49 AM]
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Hi Paul,

    I tried the code before opening the new Access app. I get an 'Object or with block variable not set' run time error.

    If I insert it after this it hides my window but leaves the Access button in the task bar, I hate to be a pain but I don't want this either on the pretext of 'If it's there it will be clicked on'. This application is an add-in for a SCADA system and some of my users are not exactly what you'd call computer literate (they have been known to phone for tech-support when the screen saver has come on).

    I have to preview the report because I need to get the criteria string in, the report is a statement detailing electricity usage and costs and in this instance has to show records from only the current day.

    Any more ideas would be greatly appreciated.

    Best regards,

    Rob Brown.

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Hi Rob,

    Yeh, I thought the task bar might be a problem. I do not think that you can stop the window coming up programatically. Have you tried playing around with the start up options?

    the only other alternative I can think of is something like Crystal Reports.

    Cheers,

    Paul
    Not nearly so tired now...

    Haven't been around much so be gentle...

  5. #5
    New Member
    Join Date
    Oct 2000
    Posts
    6

    Post Some ideas....

    If you've looked through the Microsoft knowledge base,
    checked the MSDN site, and alot of resources on the web for your answer and still can't find a way to do it...

    Your only solution might be API calls to remove the visibility of the objects all together. If done properly, you could do it without it causing any problems.

    It might be tricky, but if your real desperate you
    can pick up a book on using the Windows API in VB (Daniel Appleman makes a good one)...

    Hope this helps...

    PS: I've done similar things with the API before
    and it's not that difficult once you figure
    out which combination of API calls you need to use...


  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    I've had to do this using the ShowWindow API as follows:

    intRetVal = HideWindow(AppAccess.hWndAccessApp, 0)

    This works OK but the window still appears in the taskbar briefly after the New Access.Application statement.

    Oh well, it'll just have to do I suppose.

    Best regards,

    Rob Brown.

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