SysCmd as late binding?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike MacSween

    SysCmd as late binding?

    I'm doing this:

    strAccessPath = SysCmd(acSysCmd AccessDir) & "msaccess.e xe"

    in a vb executable to do what it looks like.

    If I remove the reference to the access object library this seems to be the
    only line the app chokes on. As the Access Obj library is the one most
    likely to be in a non-standard location I'm wondering how to do without it.
    Can I make that above late binding?

    In fact, is it possible to make all refs late binding? DAO, VB, VBA MS
    Scripting etc.

    Yours, Mike MacSween


  • Terry Kreft

    #2
    Re: SysCmd as late binding?

    Mike,
    SysCmd can be read from the Application object so (in a VB .exe form) ...

    ' *************** *************** ***********
    Private Const acSysCmdAccessD ir = 9

    Private Sub Command1_Click( )
    Dim appAccess As Object
    Dim strAccessPath As String

    Set appAccess = CreateObject("A ccess.Applicati on")

    strAccessPath = appAccess.SysCm d(acSysCmdAcces sDir) & "msaccess.e xe"

    Set appAccess = Nothing
    End Sub

    ' *************** *************** ***********

    .... works without a reference to Access.


    No, it is not possible to late bind to all objects but the vast majority can
    be.


    --
    Terry Kreft
    MVP Microsoft Access


    "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote in message
    news:4104ba53$0 $58818$5a6aecb4 @news.aaisp.net .uk...[color=blue]
    > I'm doing this:
    >
    > strAccessPath = SysCmd(acSysCmd AccessDir) & "msaccess.e xe"
    >
    > in a vb executable to do what it looks like.
    >
    > If I remove the reference to the access object library this seems to be[/color]
    the[color=blue]
    > only line the app chokes on. As the Access Obj library is the one most
    > likely to be in a non-standard location I'm wondering how to do without[/color]
    it.[color=blue]
    > Can I make that above late binding?
    >
    > In fact, is it possible to make all refs late binding? DAO, VB, VBA MS
    > Scripting etc.
    >
    > Yours, Mike MacSween
    >
    >[/color]


    Comment

    • Dimitri Furman

      #3
      Re: SysCmd as late binding?

      On Jul 26 2004, 04:01 am, "Mike MacSween"
      <mike.macsween. nospam@btintern et.com> wrote in
      news:4104ba53$0 $58818$5a6aecb4 @news.aaisp.net .uk:
      [color=blue]
      > I'm doing this:
      >
      > strAccessPath = SysCmd(acSysCmd AccessDir) & "msaccess.e xe"
      >
      > in a vb executable to do what it looks like.
      >
      > If I remove the reference to the access object library this seems to
      > be the only line the app chokes on. As the Access Obj library is the
      > one most likely to be in a non-standard location I'm wondering how to
      > do without it. Can I make that above late binding?[/color]

      You can use the FindExecutable API to find out where Access is installed
      from VB, without depending on any external library. There is a bug in
      FindExecutable with long names though (which may or may not exist in newer
      OSes), that truncates the returned path after the first space. If you need
      replacement code that does the same thing as FindExecutable, google for
      FindExe2.

      Since this approach determines the path to the executable by a file
      extention associated with it, it may get tricky when you have multiple
      versions of Access installed on the machine.

      --
      remove a 9 to reply by email

      Comment

      • Mike MacSween

        #4
        Re: SysCmd as late binding?

        "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
        news:-qqcnZMQ7P1JcZnc Sa8jmA@karoo.co .uk...[color=blue]
        > Mike,
        > SysCmd can be read from the Application object so (in a VB .exe form) ...
        >
        > ' *************** *************** ***********
        > Private Const acSysCmdAccessD ir = 9
        >
        > Private Sub Command1_Click( )
        > Dim appAccess As Object
        > Dim strAccessPath As String
        >
        > Set appAccess = CreateObject("A ccess.Applicati on")
        >
        > strAccessPath = appAccess.SysCm d(acSysCmdAcces sDir) & "msaccess.e xe"
        >
        > Set appAccess = Nothing
        > End Sub
        >
        > ' *************** *************** ***********
        >
        > ... works without a reference to Access.
        >[/color]

        Great, thanks Terry. Exactly what I meant.

        As it turned out it didn't seem to make any difference atall. This is the
        first VB thing I've done, so went through the whole packaging and deployment
        mullarkey. Tried to install using the set up routine and had all sorts of
        protests about older file versions. Then just did a straight file copy of my
        actual exe file and it worked fine. Even though I know for sure that the
        Access OLB is in a different place to mine.

        It's a front end updater thing and was astonishingly successfull. Presumably
        the machines are going to spontaneously combust in the middle of the night,
        just to wipe the smug grin off my face.
        [color=blue]
        > No, it is not possible to late bind to all objects but the vast majority[/color]
        can[color=blue]
        > be.[/color]

        And is it worth doing? Presumably things like DAO and the VB run times all
        go in a standard place.

        I've never really understood all this stuff. If on my development machine I
        have a library or a dll in c:\myspecialins tallfolderthato nlyiknowabout\
        whereas on the clients machine the same library is in
        c:\completelybo gstandardplacei tusuallygoes\ does that always smash the app?
        Or is VB (in this case) or an Access app smart enough to have a look around
        the gaff if it doesn't find it in the first place it looks in.

        Cheers, Mike MacSween


        Comment

        • Mike MacSween

          #5
          Re: SysCmd as late binding?

          "Dimitri Furman" <dfurman@cloud9 9.net> wrote in message
          news:Xns9532511 673A31dfurmancl oud99@127.0.0.1 ...[color=blue]
          > On Jul 26 2004, 04:01 am, "Mike MacSween"
          > <mike.macsween. nospam@btintern et.com> wrote in
          > news:4104ba53$0 $58818$5a6aecb4 @news.aaisp.net .uk:
          >[color=green]
          > > I'm doing this:
          > >
          > > strAccessPath = SysCmd(acSysCmd AccessDir) & "msaccess.e xe"
          > >
          > > in a vb executable to do what it looks like.
          > >
          > > If I remove the reference to the access object library this seems to
          > > be the only line the app chokes on. As the Access Obj library is the
          > > one most likely to be in a non-standard location I'm wondering how to
          > > do without it. Can I make that above late binding?[/color]
          >
          > You can use the FindExecutable API to find out where Access is installed
          > from VB, without depending on any external library. There is a bug in
          > FindExecutable with long names though (which may or may not exist in newer
          > OSes), that truncates the returned path after the first space. If you need
          > replacement code that does the same thing as FindExecutable, google for
          > FindExe2.[/color]

          Thanks Dimitri, I'll have a look at it. Am I not alone in wishing that MS
          hadn't given us file names with spaces in? I don't mind the long ones,
          that's useful, but constantly having to wrap "" round things just in case
          there's a space...
          [color=blue]
          > Since this approach determines the path to the executable by a file
          > extention associated with it, it may get tricky when you have multiple
          > versions of Access installed on the machine.[/color]

          Which would apply on my machine (and probably on most people's here) but not
          often on client's. There's a question for y'all. How many of you have
          clients (by which I mean customers) with more than one version of Access
          installed on the same machine?

          Cheers, Mike


          Comment

          • Michael \(michka\) Kaplan [MS]

            #6
            Re: SysCmd as late binding?

            "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
            [color=blue]
            > Am I not alone in wishing that MS
            > hadn't given us file names with spaces in? I don't mind the long ones,
            > that's useful, but constantly having to wrap "" round things just in case
            > there's a space...[/color]

            Well, thats a typical developer response.... the end user often expects
            spaces, though. :-)
            [color=blue]
            > Which would apply on my machine (and probably on most people's here) but[/color]
            not[color=blue]
            > often on client's. There's a question for y'all. How many of you have
            > clients (by which I mean customers) with more than one version of Access
            > installed on the same machine?[/color]

            Well, you can start looking at the different versions available.... trying
            doing a CreateObject on Access.Applicat ion.8 for 97, and so forth. This will
            attempt to get you the specific version you want....


            --
            MichKa [MS]
            NLS Collation/Locale/Keyboard Development
            Globalization Infrastructure and Font Technologies
            Windows International Division

            This posting is provided "AS IS" with
            no warranties, and confers no rights.


            Comment

            • Michael \(michka\) Kaplan [MS]

              #7
              Re: SysCmd as late binding?

              "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
              [color=blue]
              > I've never really understood all this stuff. If on my development machine[/color]
              I[color=blue]
              > have a library or a dll in c:\myspecialins tallfolderthato nlyiknowabout\
              > whereas on the clients machine the same library is in
              > c:\completelybo gstandardplacei tusuallygoes\ does that always smash the[/color]
              app?[color=blue]
              > Or is VB (in this case) or an Access app smart enough to have a look[/color]
              around[color=blue]
              > the gaff if it doesn't find it in the first place it looks in.[/color]

              Well, they are sometimes smart and sometimes not. See



              especcially in the section that starts "An additional source of pain" for
              more info on the aberrant case.


              --
              MichKa [MS]
              NLS Collation/Locale/Keyboard Development
              Globalization Infrastructure and Font Technologies
              Windows International Division

              This posting is provided "AS IS" with
              no warranties, and confers no rights.


              Comment

              • Mike MacSween

                #8
                Re: SysCmd as late binding?

                "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                message news:41067b67$1 @news.microsoft .com...[color=blue]
                > "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                >[color=green]
                > > I've never really understood all this stuff. If on my development[/color][/color]
                machine[color=blue]
                > I[color=green]
                > > have a library or a dll in c:\myspecialins tallfolderthato nlyiknowabout\
                > > whereas on the clients machine the same library is in
                > > c:\completelybo gstandardplacei tusuallygoes\ does that always smash the[/color]
                > app?[color=green]
                > > Or is VB (in this case) or an Access app smart enough to have a look[/color]
                > around[color=green]
                > > the gaff if it doesn't find it in the first place it looks in.[/color]
                >
                > Well, they are sometimes smart and sometimes not. See
                >
                > http://trigeminal.com/usenet/usenet026.asp
                >
                > especcially in the section that starts "An additional source of pain" for
                > more info on the aberrant case.[/color]

                Thanks Michael, I'll look at that.
                [color=blue]
                >
                > --
                > MichKa [MS]
                > NLS Collation/Locale/Keyboard Development
                > Globalization Infrastructure and Font Technologies
                > Windows International Division
                >
                > This posting is provided "AS IS" with
                > no warranties, and confers no rights.
                >
                >[/color]


                Comment

                • Mike MacSween

                  #9
                  Re: SysCmd as late binding?

                  "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                  message news:41067ab5$1 @news.microsoft .com...[color=blue]
                  > "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                  >[color=green]
                  > > Am I not alone in wishing that MS
                  > > hadn't given us file names with spaces in? I don't mind the long ones,
                  > > that's useful, but constantly having to wrap "" round things just in[/color][/color]
                  case[color=blue][color=green]
                  > > there's a space...[/color]
                  >
                  > Well, thats a typical developer response.... the end user often expects
                  > spaces, though. :-)[/color]

                  Not until they were given spaces. Up to then they had to come up with 8.3
                  filenames. The more I do of this the more I think we ought to stop trying to
                  kid users into thinking that using a computer is like a washing machine
                  [color=blue]
                  >[color=green]
                  > > Which would apply on my machine (and probably on most people's here) but[/color]
                  > not[color=green]
                  > > often on client's. There's a question for y'all. How many of you have
                  > > clients (by which I mean customers) with more than one version of Access
                  > > installed on the same machine?[/color]
                  >
                  > Well, you can start looking at the different versions available.... trying
                  > doing a CreateObject on Access.Applicat ion.8 for 97, and so forth. This[/color]
                  will[color=blue]
                  > attempt to get you the specific version you want....[/color]

                  Good idea, thanks.

                  Mike
                  [color=blue]
                  >
                  > --
                  > MichKa [MS]
                  > NLS Collation/Locale/Keyboard Development
                  > Globalization Infrastructure and Font Technologies
                  > Windows International Division
                  >
                  > This posting is provided "AS IS" with
                  > no warranties, and confers no rights.
                  >
                  >[/color]


                  Comment

                  • Michael \(michka\) Kaplan [MS]

                    #10
                    Re: SysCmd as late binding?

                    "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                    [color=blue]
                    > Not until they were given spaces. Up to then they had to come up with 8.3
                    > filenames. The more I do of this the more I think we ought to stop trying[/color]
                    to[color=blue]
                    > kid users into thinking that using a computer is like a washing machine[/color]

                    The problem is that you are really wrong here, and you get more and more
                    wrong with each passing day. It might be good to adjust your thinking to
                    match the way computers are going, so that you better reflect the reality of
                    your chosen profession. :-)


                    --
                    MichKa [MS]
                    NLS Collation/Locale/Keyboard Development
                    Globalization Infrastructure and Font Technologies
                    Windows International Division

                    This posting is provided "AS IS" with
                    no warranties, and confers no rights.


                    Comment

                    • Mike MacSween

                      #11
                      Re: SysCmd as late binding?

                      "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                      message news:4107aba0@n ews.microsoft.c om...[color=blue]
                      > "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                      >[color=green]
                      > > Not until they were given spaces. Up to then they had to come up with[/color][/color]
                      8.3[color=blue][color=green]
                      > > filenames. The more I do of this the more I think we ought to stop[/color][/color]
                      trying[color=blue]
                      > to[color=green]
                      > > kid users into thinking that using a computer is like a washing machine[/color]
                      >
                      > The problem is that you are really wrong here, and you get more and more
                      > wrong with each passing day.[/color]

                      You do say the most extraordinary things Michael. I hardly ever post here.
                      How do you know how much wronger or righter I get 'with each passing day'.
                      What do you have to base your assumptions on?
                      [color=blue]
                      > It might be good to adjust your thinking to
                      > match the way computers are going, so that you better reflect the reality[/color]
                      of[color=blue]
                      > your chosen profession. :-)[/color]

                      I see tens, hundreds of users who sit down at PCs and think it's all just
                      going to be wonderful, who have been totally convinced by software and
                      hardware companies into thinking that this is some sort of piece of consumer
                      electronics, who then become disillusioned when it doesn't work like one.

                      And no, before you make some sort of sarcastic comment that maybe its just
                      the shit that I program, not with my database apps, but with perfectly
                      ordinary productivity software sold by major companies.

                      Maybe it's all going to change. OSs are getting better. XP seems a good deal
                      more stable than it's predecessors, though most people use only those
                      features that were already available in Office 97. Outlook is overkill for
                      many but good for some, Finale is complex but more power than Sibelius,
                      Cubase has gone as far as it ought, Digidesign has successfully integrated
                      hard and software to produce a stable platform and appears to have migrated
                      to Windows OK.

                      We'll see.

                      I'm still not bothered about space in filenames though.

                      Mike


                      Comment

                      • Michael \(michka\) Kaplan [MS]

                        #12
                        Re: SysCmd as late binding?

                        "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                        [color=blue]
                        > You do say the most extraordinary things Michael. I hardly ever post here.
                        > How do you know how much wronger or righter I get 'with each passing day'.
                        > What do you have to base your assumptions on?[/color]

                        You misunderstand -- am I saying that this one solitary opinion is becoming
                        less and less reflective of computing every day.
                        [color=blue]
                        > I'm still not bothered about space in filenames though.[/color]

                        Thats good -- progress! :-)


                        --
                        MichKa [MS]
                        NLS Collation/Locale/Keyboard Development
                        Globalization Infrastructure and Font Technologies
                        Windows International Division

                        This posting is provided "AS IS" with
                        no warranties, and confers no rights.


                        Comment

                        • Mike MacSween

                          #13
                          Re: SysCmd as late binding?

                          "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                          message news:4107d2ad$1 @news.microsoft .com...[color=blue]
                          > "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                          >[color=green]
                          > > You do say the most extraordinary things Michael. I hardly ever post[/color][/color]
                          here.[color=blue][color=green]
                          > > How do you know how much wronger or righter I get 'with each passing[/color][/color]
                          day'.[color=blue][color=green]
                          > > What do you have to base your assumptions on?[/color]
                          >
                          > You misunderstand -- am I saying that this one solitary opinion is[/color]
                          becoming[color=blue]
                          > less and less reflective of computing every day.[/color]

                          Er, I don't know, are you?



                          Comment

                          • Michael \(michka\) Kaplan [MS]

                            #14
                            Re: SysCmd as late binding?

                            Yes, I am.


                            --
                            MichKa [MS]
                            NLS Collation/Locale/Keyboard Development
                            Globalization Infrastructure and Font Technologies
                            Windows International Division

                            This posting is provided "AS IS" with
                            no warranties, and confers no rights.


                            "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote in message
                            news:4107da0a$0 $58816$5a6aecb4 @news.aaisp.net .uk...[color=blue]
                            > "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                            > message news:4107d2ad$1 @news.microsoft .com...[color=green]
                            > > "Mike MacSween" <mike.macsween. nospam@btintern et.com> wrote...
                            > >[color=darkred]
                            > > > You do say the most extraordinary things Michael. I hardly ever post[/color][/color]
                            > here.[color=green][color=darkred]
                            > > > How do you know how much wronger or righter I get 'with each passing[/color][/color]
                            > day'.[color=green][color=darkred]
                            > > > What do you have to base your assumptions on?[/color]
                            > >
                            > > You misunderstand -- am I saying that this one solitary opinion is[/color]
                            > becoming[color=green]
                            > > less and less reflective of computing every day.[/color]
                            >
                            > Er, I don't know, are you?
                            >
                            >
                            >[/color]


                            Comment

                            Working...