Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Unanswered: AWKKK! shell in VBA & Core-Duo & BIOS u/g

    izyMegaCorp recently passed-thru to users a need for BIOS upgrades for core-duo machines (supposedly because of some prob with uCode chez-Intel)

    *ALL* izyMegaCorp users use the same reporting module in all aplications.

    in essence the reporting module is fed a RPT and a drivepathname.ext and creates a .SNP with
    Code:
    DoCmd.OutputTo acOutputReport, ReportNameVar, "Snapshot Format", ReportSavePathVar
    and then the next line shells to snapview.exe with
    Code:
        strShell = SnapviewExePath & " " & ReportSavePathVar
        Call Shell(strShell, vbNormalFocus)
    to preview the report.

    +/- a million reports worked fine this way.
    ...today the first user did the BIOS u/g and trashed his reporting.

    mmmm - ideas please! soon pleeeeeeeease!

    izy
    currently using SS 2008R2

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    I don't know, but there are at least two other methods that you can try.

    One is the hyperfollowlink thingie (don't remember the name of it, have never used it) of the application object.

    The second, is the ShellExecute API (the wrapper from http://www.mvps.org/access/api/api0018.htm is nice and handy).

    Neither of these methods need the name of the application, but will use the extension of the path/file (ReportSavePathVar) passed and use the application it's registered for.
    Roy-Vidar

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Example of shelling

    Here's a program I developed which uses both the shell and API call to open a program which you may or may not find useful. The key module is: Opening a Program and Open a Program which also has the ShellExecute API call Royvidar suggested.

    "PLEASE" Excuse the sloppy code and lack of comments (I made it in a few hours) but it should be fairly straight-forward for someone advanced like yourself. It's a nice menu type program which shells to any word, excel, MSAccess, etc. type documents and opens them. It will even create a desktop shortcut. It's a little messy code-wise though (and embarrasing to show) since I didn't have time to "clean-it-up" but it works pretty good. You can utilize what you need from it. Also, there are a lot of different modules in it which I don't use but the "Open a Program" and "Opening a Program" modules are the key ones you want to look at for opening a file.

    If you want to use the actual program as it works and see it in action, you'll need to empty the dbo_LookupFiles table and use the PopulateTable form and populate it with data from whatever drive and filetype you specify. Keep in mind that I had to develop this fairly quickly to accommodate the necessity.

    strShell = SnapviewExePath & " " & ReportSavePathVar
    Call Shell(strShell, vbNormalFocus)

    You may also want to try...
    strShell = SnapviewExePath & chr(34) & ReportSavePathVar
    Call Shell(strShell, vbNormalFocus)
    which you'll see that I used as I found it worked better than the " ".

    Hold the shift key down when opening it to see the code as I use an api to get rid of the MSAccess information and just show the form.
    Attached Files Attached Files
    Last edited by pkstormy; 07-23-07 at 18:55.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    thanks both!
    after some netmeeting remote control games on a test .MDB it turns out that Shell() is not the issue - it falls over on:
    Code:
    DoCmd.OutputTo acOutputReport, snpReportName, "Snapshot Format", snpFullPath
    with error 3011.
    identical code on 99 other machines runs smoothly.

    i replaced "Snapshot Format" with "NONSENSE"
    ...error 2282 format not available.

    i built a new MDE replacing "Snapshot Format" with intrinsic acFormatSNP and will see if this helps user-X, but i'm not confident.

    other info:

    debugging immediately before the offending line:
    snpFullPath evaluates to "c:\temp\mySnap.snp"
    c:\temp is verified to exist
    c:\temp\mySnap.snp has been deleted (if it existed)
    acOutputReport evaluates correctly to 3
    snpReportName evaluates to a valid existing report name (and works on the other 99 machines)

    any ideas where i can look?

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Thanks for letting us know izy.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Aug 2007
    Location
    Copenhagen, Denmark
    Posts
    2
    Hi Izyrider,

    Did you find a solution for this ? - I would be very interested in hearing about it then, as we're in the exact same situation - export to snp works on many pc's but not on one or two.

    Thanks
    Michael

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    Michael,
    YES - this problem is fixed for my user.

    it was related to a network printer (this user's default printer): the settings on this printer were complete madness ...i forget the details but there was some issue with bin/papersize or similar. (i don't see how the BIOS u/g could be responsible for these settings so maybe it was just a coincidence and some other user made some stupid changes at around the same time)

    switching to another default printer fixed the issue immediately.
    reinstalling the original default printer and making it default - everything was still OK.

    check the misbehaving clients to make sure their default printer is correctly installed, has a sensible default paper size in a physically existing bin etc etc etc.

    good luck with it!

    izy
    currently using SS 2008R2

  8. #8
    Join Date
    Aug 2007
    Location
    Copenhagen, Denmark
    Posts
    2
    Hi Izyrider,

    Excellent ! - that solved it !

    Have a nice weekend
    Michael

Posting Permissions

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