473,793 Members | 2,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Evaluating References in Code [Long]

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

Dec 1 '05
30 2490
TC wrote:
See if you can work out which of those three people, is you.


Christmas is a very stressful time of year...

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Dec 4 '05 #21
TC
Ain't that the truth!

TC

Dec 4 '05 #22
Well, by my counting of responders in this branch of the thread you've just
called David Epsom a wanker, which in my experience is not true, I therefore
think you owe him an apology.

BTW my answer, if you had bothered to check, was to the question of whether
the references changed when the loaded database changed, but of course
you're too busy getting wound up about an irrelevant aside, which I have
already justified, to be concerned with irrelevancies such as that.

Oh, and trimming your reply where you randomly attempted to insult me
doesn't make it dissapear.

To be honest at the moment you needn't worry about me interrupting one of
your "technical" discussions again because your lack of rational thought and
apparent lack of technical knowledge makes it seem to me that it wouldn't be
a worthwhile experience for either of us.

<PLONK>

--
Terry Kreft

"TC" <aa**********@y ahoo.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Terry, see if you can follow along. Really try to concentrate.

- Person 'A' is involved in a technical discussion with person 'B'.
- Person 'A' asks person 'B' to clarify their position.
- Some random wanker 'C' drops into the thread, for the first time, to
tell person 'A' that the issue is obvious ("I'm trying hard not so say
"of course").
- Person 'A' asks person 'C' - twice - to justify their statement.
- Person 'C' replies with a fact that is, in truth, completely
irrelevant the issue at hand.
- Person 'A' restates the technical issue that the thread is about.
- Person 'C' replies with random invective.

See if you can work out which of those three people, is you.

TC

Dec 4 '05 #23
You've done that wrong:
5. open a different one which definitely does have different references
6. repeat step 3.
Should be
5. repeat step 1.

The behaviour is not the same, and if you wish to use code
like that (instead of the code in the original question),
you should make your own tests.

(david)
"TC" <aa**********@y ahoo.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com... 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

Dec 4 '05 #24
TC

Terry Kreft wrote:

Well, by my counting of responders in this branch of the thread you've just
called David Epsom a wanker, which in my experience is not true, I therefore
think you owe him an apology.
Good Lord man, * Y O U * are person (C) in that script! Can't you
read the words on the page?

BTW my answer, if you had bothered to check, was to the question of whether
the references changed when the loaded database changed
You did answer that, which was fine. I have no objection to that,
that's the reason why people ask questions. They hope to get answers.
It was obvious from my reply to David Epsom, that I was asking him to
confirm my understanding of what he said. You stepped in & did that for
him. No poblems up to that point.

but of course you're too busy getting wound up about an irrelevant aside
It was an aside which obviously offended me. You could easily have
neutralized that by a suitably worded reply. You chose not to bother. I
chose not to accept that.

<PLONK>


We're certainly getting nowhere with this, and I have much more
pressing things to do with my time. Please do no ever reply to any of
my posts again. I'll try hard to deal with the fearful ramifications of
that. I'll advise my clients that my level of expertise will plummet
alarmingly.

TC

Dec 5 '05 #25
"TC" <aa**********@y ahoo.com> wrote
<PLONK>
pressing things to do with my time. Please do no ever reply to any of
my posts again.


PLONK implies that he won't ever _see_ your posts again.
I'll try hard to deal with the fearful ramifications of
that. I'll advise my clients that my level of expertise
will plummet alarmingly.


I don't have any idea of your level of expertise, but I can assure you that
Terry Kreft's level of expertise is quite high. I wouldn't, even in a fit of
pique, cut myself off from his excellent knowledge of Access. On the other
hand, as _he_ has PLONKed _you_, you don't really seem to have much choice
in the matter. :-)
Dec 5 '05 #26
TC

Larry Linson wrote:
I don't have any idea of your level of expertise,


Well, I must have made at least 6000 posts at various times in the last
10 years, and I doubt that any more than 2 or 3 of those were
questions. All the rest were answers. So that should give you some
idea.

But I come here very rarely now. There are too many egos & posturing. I
enjoy a robust discussion of technical issues, but that seems very hard
in this group.

You won't see any of that behaviour in the MS beta newsgroups. Look
there for a good example of how it should go. There are robust
discussions of Office & Access 12 at present, but no-one is making
snide comments, or being disrespectful to others.

I post in those groups, with the same tone I have posted here. But I've
not got into any arguments there. Maybe that should tell you something.

Cheers,
TC

Dec 5 '05 #27
Lyle,

One red-headed cupcake headed your way, Lyle. Turns out it was just one
function that was using ADOX, and it was quite easily rebuilt using ADO
and an SP. Thanks much.

Jeremy

Dec 5 '05 #28
Great; red-headed cupcakes will generally motivate me to do anything!

Dec 5 '05 #29
I offer the following code because I continue to be
unconvinced of the need for something more complex:

Private Declare Function GetFileVersionI nfo& Lib "Version" Alias
"GetFileVersion InfoA" (ByVal FileName$, ByVal lptr&, ByVal lSize&, lpvData
As Any)
Public Function gfn_GetVersion( FileName$)
'2003/02/26 dlg --minimalist version -- Right to attribution retained
Dim iBuf(0 To 99) As Integer

Call GetFileVersionI nfo(FileName$, 0&, 200, iBuf(0))
gfn_GetVersion = iBuf(25) & "." & iBuf(24) & "." & iBuf(27) & "." &
iBuf(26) 'FILE VERSION

End Function
"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
If I were rude I'd say the end result would be the same, but I'm not
rude. My evil twin, Kyle, might not be so circumspect!
Moving right along, I believe somewhere in the thread you indicated
that it might help to be able to ascertain the version of ADOX
available on the machine.
As you have specified an ADP, I beleive we can be assured of Access >=
2000 and an ADODB reference. I believe that the ADOX dll will reside in
the same directory as the msado dll. So, based on those assumptions I
offer this, which is a very minor adaption of some other code that I
run, [the one to use is ADOXVersion()]:

Option Explicit

Private Declare Sub CopyMemory _
Lib "kernel32" Alias "RtlMoveMem ory" _
(Destination As Any, Source As Any, ByVal Length As Long)

Private Declare Function GetFileVersionI nfo _
Lib "version.dl l" Alias "GetFileVersion InfoA" _
(ByVal lptstrFilename As String, ByVal DWHandle As Long, _
ByVal dwLen As Long, lpData As Any) As Long

Private Declare Function GetFileVersionI nfoSize _
Lib "version.dl l" Alias "GetFileVersion InfoSizeA" _
(ByVal lptstrFilename As String, lpdwHandle As Long) As Long

Private Declare Function VerQueryValue _
Lib "version.dl l" Alias "VerQueryValueA " _
(pBlock As Any, ByVal lpSubBlock As String, _
LPLPBuffer As Any, PULen As Long) As Long

Public Function VersionNumber(B yVal FullPath As String) As String
Dim Buffer() As Byte
Dim DWHandle As Long
Dim FileVersionInfo Size As Long
Dim LPLPBuffer As Long
Dim SubVersion As Integer
Dim Version As Integer

FileVersionInfo Size = GetFileVersionI nfoSize(FullPat h, DWHandle)
If FileVersionInfo Size <> 0 Then
ReDim Buffer(FileVers ionInfoSize)
GetFileVersionI nfo FullPath, 0, FileVersionInfo Size, Buffer(0)
VerQueryValue Buffer(0), "\", LPLPBuffer, FileVersionInfo Size
ReDim Buffer(51)
CopyMemory Buffer(0), ByVal LPLPBuffer, 52
CopyMemory Version, Buffer(10), 2
CopyMemory SubVersion, Buffer(14), 2
VersionNumber = "Version " & Version & "." & SubVersion
Else
VersionNumber = "Could Not Retrieve Version Information for " _
& FullPath
End If
End Function

Public Function ADOXVersion() As String
Dim Path As String
Dim Drive As String
Dim Dir As String
Dim File As String
Dim Ext As String

With WizHook
.Key = 51488399
.SplitPath References("ADO DB").FullPath , Drive, Dir, File, Ext
End With

ADOXVersion = VersionNumber(D rive & Dir & "msadox.dll ")
End Function

Notes:
The work of Wizhook could be done in any number of ways, but Wizhook
annoys David, so I use it whenever I can.
51488399 is the number of redheads who have turned me down. When it is
ANDed with the total number of redheads in the universe the result is
51488399.

Dec 5 '05 #30

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

Similar topics

33
2404
by: JKop | last post by:
I understand variables/objects and pointer variables perfectly: int X = 5; int* pX = &X; *pX = 4; int** ppX = &pX:
25
6213
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...
11
1992
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?
1
1422
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
28
2040
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...
3
2117
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
15
3139
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,
29
1517
by: Simon Saize | last post by:
Hi - What's the point of having references (&)? Why don't we just use pointers (*)? Thanks.
2
2608
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-
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
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,...
1
10159
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,...
0
9033
agi2029
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...
1
7538
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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
3
2917
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.