I've got an adp (Metrix.adp) with a reference to another adp
(InteractSQL.ad p). InteractSQL sits on a server, and is refered to by
all of the clients (Metrix), which sit on the client machines (There's
also a SQL Server that sits on the server, but that's besides the point
here.). Both adp files have references to ADOX. I've got to check
Metrix has an older version of ADOX, and react appropriately. I've
written code to do this, and it looks like it should work. But it
doesn't and I can't figure out why.
I would love any thoughts on what might be going wrong with my code. I
would also love any thoughts on other ways that I could go about
assessing what version of ADOX is being refered to in an adp to which
I have a reference set. Another way to go about this would be to figure
out what version of MDAC is on another computer on the network.
The code (below) runs in Metrix, and walks the collection of references
in that file. When it encounters the ADOX reference, it just gathers
the version. When it encounters the InteractSQL reference, it then
walks the reference collection of that object, again gathering the
version number when it finds the ADOX reference.
I've got two machines set up. The client machine has a reference to
ADOX 2.7 in the Metrix file. The InteractSQL file on the server has a
reference to ADOX 2.8 (a scenario we encounter a lot at client sites).
But the code reports back that they are both 2.7. When I go back to
InteractSQL.adp , though, it's reference is clearly still set to 2.8.
Thanks much for any help on this.
Jeremy
--
Jeremy Wallace
Fund for the City of New York
Function fnInteractRepor tRefsValid() As Boolean
On Error GoTo Error
Dim refParent As Access.Referenc e
Dim appChildDB As Application
Dim refChild As Access.Referenc e
Dim lngParentVersio n As Long
Dim lngChildVersion As Long
Dim strInteractFile As String
'Can't know how the references will be named, so get rid of the
extension, if it's there
strInteractFile = Replace(INTERAC TFILE, ".adp", "")
'Walk the collection of references set in Metrix.adp
For Each refParent In References
If refParent.Name = "ADOX" Then
'Gather the local mdac version, which we'll later compare to
the one in interact.
lngParentVersio n = CLng(refParent. Major & "." &
refParent.Minor )
ElseIf refParent.Name Like "*" & strInteractFile & "*" Then
If refParent.IsBro ken = True Then
'Report back if it's broken.
fnInteractRepor tRefsValid = False
Else
'Gather the version of mdac refered to in InteractSQL.adp .
Set appChildDB = New Access.Applicat ion
Call appChildDB.Open AccessProject(r efParent.FullPa th)
For Each refChild In appChildDB.Refe rences
If refChild.Name = "ADOX" Then
lngChildVersion = CLng(refChild.M ajor & "." &
refChild.Minor)
End If
Next refChild
appChildDB.Clos eCurrentDatabas e
End If
End If
Next refParent
If lngChildVersion > lngParentVersio n Then
'Do some stuff
End If
ExitPoint:
On Error Resume Next
'Clean-up code
Exit Function
Error:
'Error handling
End Function 30 2487
Not to answer your question, but, that code will never handle broken
references.
If /any/ refrence is broken, /all/ your VBA code will start to
malfunction. Your code will die, before you even get to check IsBroken.
To avoid this problem, you have to qualify every item that you use in
you code, with the name of the library in which that item occurs. Eg.
you could not say: msgbox "this" & vbcrlf & "that". It would have to be
Access.msgbox "this" & VBA.vbcrlf & "that". (I haven't checked those
library names, they might be wrong, but hopefully you get my point.)
There are other requirments that you have to meet also. It's difficult
- but doable. Google the Access groups for the term "disambigua te" (and
variants) for more information.
HTH,
TC
TC,
Yeah, that's true. This is code that I inherited. At some point (though
not before the next release) I'll look into whether or not we should
just pull the IsBroken bit from this code. At this point I can't see
that it hurts much. It's possible that we'll fully disambiguate
everything in the code, but it's thousands of lines of code, so I'm not
holding my breath for that one.
In any case, if any one else has any thoughts about what to do to
return the correct version number from the
reference-within-a-reference, I'd love to hear them.
Thanks much.
Jeremy
--
Jeremy Wallace
Fund for the City of New York
Well, I don't have any experience with Access Data Projects (or
whatever they're called) - but this looks wrong to me:
Set appChildDB = New Access.Applicat ion
Call appChildDB.Open AccessProject(r efParent.FullPa th)
For Each refChild In appChildDB.Refe rences
If the references are a property of the access application object, you
would not need to open the access project. Conversly, if the references
are a property of the opened access project, you should save the object
reference that is returned by the OpenAccessProje ct method, and get at
the references though that object reference. IOW your code, as
currently written, is probably looking at the default references
collection that exists in Access /before/ any partiular database or
access project has been opened.
HTH,
TC je************@ gmail.com wrote: I would love any thoughts on what might be going wrong with my code. I would also love any thoughts on other ways that I could go about assessing what version of ADOX is being refered to in an adp to which I have a reference set.
If you don't use ADOX and don't set a reference to it you can pretty
much guarantee that the version will be 0000.000.
I don't know of anything that ADOX is needed for with an ADP. (MS-SQL
is extremely powerful!). Do you know of something that requires ADOX?
Could you tell us what it is?
Looks ok to me:
create new application object
load file into new application object
look at references in new application object.
(david)
"TC" <aa**********@y ahoo.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com... Well, I don't have any experience with Access Data Projects (or whatever they're called) - but this looks wrong to me:
Set appChildDB = New Access.Applicat ion Call appChildDB.Open AccessProject(r efParent.FullPa th) For Each refChild In appChildDB.Refe rences
If the references are a property of the access application object, you would not need to open the access project. Conversly, if the references are a property of the opened access project, you should save the object reference that is returned by the OpenAccessProje ct method, and get at the references though that object reference. IOW your code, as currently written, is probably looking at the default references collection that exists in Access /before/ any partiular database or access project has been opened.
HTH, TC je************@ gmail.com wrote: It's possible that we'll fully disambiguate everything in the code, but it's thousands of lines of code, so I'm not holding my breath for that one.
You only need to disambiguate the code that checks for broken
references. Typically, this is only a few dozen lines of code. You put
this in a seperate module. The rest of the code (ie. the main code of
the application) is not affected at all.
HTH,
TC
And that is precisely his error, imho! He is checking the references
which belong to the application object. He should be checking the
references which belong to the access project that he opened within the
application object. Those are not the same thing. He is checking the
wrong object, imho.
Cheers,
TC
no, I look at App.References in my code, not
App.CurrentProj ect.references.
I don't know why that is, but there you are.
If MS had implemented App.CurrentProj ect.References,
then they probably could have implemented
App.CurrentProj ect.References( n).References,
Which would have been a useful feature.
Because the two logical helpful things they could
have done are
a) expose all the loaded references in app.references
or
b) expose the indirect references through
currentproject. references(n).r eferences
But references of your references aren't exposed
by the application object by any method - you only
get shown the direct references, and to check the indirect
references you need to create other application objects.
(david)
"TC" <aa**********@y ahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . And that is precisely his error, imho! He is checking the references which belong to the application object. He should be checking the references which belong to the access project that he opened within the application object. Those are not the same thing. He is checking the wrong object, imho.
Cheers, TC
Ok, let me check I understand what you're saying. You're saying that
the References collection of the Application object, does return the
references of the specific database or access project that is currently
open in that object? So, in the following sequence of actions, steps 3
and 6 would return different information?
1. automate a new instance of Access;
2. open a database or access project in that instance;
3. print all the details of the Application object, Refrences
collecion;
4. close that database or access project;
5. open a different one which definitely does have different references
to the previous one;
6. repeat step 3.
Cheers,
TC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JKop |
last post by:
I understand variables/objects and pointer variables perfectly:
int X = 5;
int* pX = &X;
*pX = 4;
int** ppX = &pX:
|
by: Steve Jorgensen |
last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right?
Ok, here goes. I've been trying to improve encapsulation by putting code
in the same object as the stuff it affects, so I rarely refer to a subform
ir parent form's controls or records from the other form. Instead, I call
a procedure in that form that does the job.
That's all fine and good, and nothing at all revolutionary, but it leaves
one with an annoying...
|
by: codebloatation |
last post by:
I know how to use references but i DO not get WHY they exist other than
to add to the language. Are they actually needed for anything?
|
by: kaosyeti |
last post by:
is there an easy way to evaluate a calculated control step by step? i have a
lot of long expressions in a lot of my controls and if there's an error,
tracking it down is a PAIN. excel has a built-in function for evaluating
formulas... does access? thanks.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200601/1
|
by: Frederick Gotham |
last post by:
When I was a beginner in C++, I struggled with the idea of references.
Having learned how to use pointers first, I was hesitant to accept that
references just "do their job" and that's it.
Just recently, a poster posted looking for an explanation of references.
I'll give my own understanding if it's worth anything.
First of all, the C++ Standard is a very flexible thing. It gives a
mountain of freedom to implementations to do things...
| |
by: DonJefe |
last post by:
Does anyone have experience using project->project references in large
solutions? What are the plus/minuses that you have found?
Currently, we are using the binary assembly references for our code,
but this becomes problematic when you want to build from multiple
branches/working directories.
Any thoughts on this would be appreciated.
Thanks
|
by: sara |
last post by:
I am stuck.
I have a report that I use in multiple places, so I call it with
varying parameters (using the Where Clause in the code).
I preview the report, send it to snap, then close the preview (the
user can go to the server to see the snap view). Print, snap, then
close is the only way I can snap with a Where clause.
If there is No data that meets the criteria, I can cancel the print,
|
by: Simon Saize |
last post by:
Hi -
What's the point of having references (&)? Why don't we just use
pointers (*)?
Thanks.
|
by: Ken Camann |
last post by:
Hey everyone.
First of all let me say that I know that the C++ standard never makes
any guarantees about compiler implementation and thus about the
performance of any language feature. That said, r-value references
are clearly being included because they make certain optimization
analysis cases possible to identify, and every compiler will try to
include them.
Anyway, I've been playing around with some code in ConceptGCC using r-
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |