473,804 Members | 3,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 13 '05 #1
13 3141
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" <mi************ ******@btintern et.com> wrote in message
news:41******** *************** @news.aaisp.net .uk...
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

Nov 13 '05 #2
On Jul 26 2004, 04:01 am, "Mike MacSween"
<mi************ ******@btintern et.com> wrote in
news:41******** *************** @news.aaisp.net .uk:
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?


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
Nov 13 '05 #3
"Terry Kreft" <te*********@mp s.co.uk> wrote in message
news:-q************** ******@karoo.co .uk...
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.

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.
No, it is not possible to late bind to all objects but the vast majority can be.


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
Nov 13 '05 #4
"Dimitri Furman" <df*****@cloud9 9.net> wrote in message
news:Xn******** *************** *****@127.0.0.1 ...
On Jul 26 2004, 04:01 am, "Mike MacSween"
<mi************ ******@btintern et.com> wrote in
news:41******** *************** @news.aaisp.net .uk:
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?
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.


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...
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.


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
Nov 13 '05 #5
"Mike MacSween" <mi************ ******@btintern et.com> wrote...
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...
Well, thats a typical developer response.... the end user often expects
spaces, though. :-)
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?


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.
Nov 13 '05 #6
"Mike MacSween" <mi************ ******@btintern et.com> wrote...
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.


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.
--
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.
Nov 13 '05 #7
"Michael (michka) Kaplan [MS]" <mi*****@online .microsoft.com> wrote in
message news:41******** @news.microsoft .com...
"Mike MacSween" <mi************ ******@btintern et.com> wrote...
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.


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.


Thanks Michael, I'll look at that.

--
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.

Nov 13 '05 #8
"Michael (michka) Kaplan [MS]" <mi*****@online .microsoft.com> wrote in
message news:41******** @news.microsoft .com...
"Mike MacSween" <mi************ ******@btintern et.com> wrote...
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...
Well, thats a typical developer response.... the end user often expects
spaces, though. :-)


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
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?


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....
Good idea, thanks.

Mike

--
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.

Nov 13 '05 #9
"Mike MacSween" <mi************ ******@btintern et.com> wrote...
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


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.
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3979
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: ********************************************************* Public Sub MailMerge(strQuery As String, strTemplate As String) snip Dim doc As Word.Document Dim wrdApp As Word.Application snip Set wrdApp = New Word.Application
1
7942
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right version of the MS Graph type library. Up until now I have been walking them through the process of setting the references to include their version of MS Graph library. My problem is that I can not seem to get the syntax correct .. or perhaps...
14
4312
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs hundreds of lines of code to format a Word document in a very specific way. Because my clients have various versions of Word, the problem of broken references comes up. I wish Microsoft had implemented a reasonable solution, so that VBA could do...
9
10431
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
5
2056
by: eBob.com | last post by:
In another thread VJ made me aware of Tag. Fantastic! I've been wanting this capability for a long time. But it seems that I cannot use it with Option Strict On. In an event handler I have ... Private Sub chkbxSelI_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox("bingo for number " & sender.Tag.ToString) End Sub
30
2840
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as integer The integers in these arrays are actually pointers to different columns of data in a text file.
6
1897
by: Tim Roberts | last post by:
I've been doing COM a long time, but I've just come across a behavior with late binding that surprises me. VB and VBS are not my normal milieux, so I'm hoping someone can point me to a document that describes this. Here's the setup. We have a COM server, written in Python. For completeness, here is the script: ----- testserver.py ----- import pythoncom
3
16074
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile time (Early Binding) or run time (Late Binding). When you declare an Object Variable as a specific Data Type, you are using Early Binding so the verification can take place during compile time. When you declare a Variable of the generic Object Data...
14
2044
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late binding", I am struggling to understand why I am tripping this error. This is the code that causes the problems: XLApp.Goto("MonthTitleTL") 'Goes to bookmark in sheet r = XLApp.ActiveCell.Row 'sets variable r equal
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.