Porting from 2003 to 2007

H

H. Martins

While trying for the first time to run a functioning 2003 code I got
into an error and I don't know what to do about it.

I pasted the following code into a module called General (where a
couple more general functions are located), adding a header like:

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

The function is:

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Public Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUsername As String
strUsername = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUsername, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUsername, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function

I don't understand this code, I just pasted it.

Now I a getting the error:

"Can't find project or library."

.... apparently the compiler doesn't like "String$"

Can I have some help, please?
Thanks
Henry
 
D

Douglas J. Steele

Probably a problem with your References collection.

Go into the VB Editor, and select References from the Tools menu. Look at
the selected ones at the beginning of the list. I suspect one (or more) will
have MISSING: in front.

My standard advice is:

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected.

NOTE: write down what the references are before you delete them, because
they'll be in a different order when you go back in!
 
H

H. Martins

Ok.

Under 2003 it shows (selected) Microsoft Office Web Components 11.0.

Under 2007 the above item is shown as missing.

If I unselect it doesn't show up again. Meanwhile I found out this
link:
http://www.pcreview.co.uk/forums/thread-2186593.php

C:\Program Files\Common Files\Microsoft Shared\Web Components
\11\OWC11.DLL
Only yhis file results in "Microsoft Office Web Components 11.0"

What must be wrong in the 2003 project so that 2007 produces that
error?

Now, for the time coming I must still do a couple things under 2003
because most users are working OK until I can have a stable 2007 .mde
running. I found out, meanwhile, that some other eventually small
things must be also worked out. One of them is the #Name? that 2003
displays but goes on and apparently 2007 doesn't.


Thanks
Henry
 
D

Douglas J. Steele

Did your application compile cleanly after removing the reference? If so,
you didn't need it.
 
H

H. Martins

Did your application compile cleanly after removing the reference? If so,
you didn't need it.

Thanks Doug,

Indeed it seems the library(?) was not in use.

The funny thing is that when I unselected it from the development
version it disappeared from the production version.

Is this sort of 'library'(?) list defined in a global basis? I have
other minor projects quite different from this one and, if this global
matter is confirmed, I might have side effects on other projects.

Thanks
Henry
 
D

Douglas J. Steele

References are on a database-by-database basis, not Access -wide.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Did your application compile cleanly after removing the reference? If so,
you didn't need it.

Thanks Doug,

Indeed it seems the library(?) was not in use.

The funny thing is that when I unselected it from the development
version it disappeared from the production version.

Is this sort of 'library'(?) list defined in a global basis? I have
other minor projects quite different from this one and, if this global
matter is confirmed, I might have side effects on other projects.

Thanks
Henry
 
T

Tony Toews [MVP]

H. Martins said:
Indeed it seems the library(?) was not in use.

The funny thing is that when I unselected it from the development
version it disappeared from the production version.

Is this sort of 'library'(?) list defined in a global basis? I have
other minor projects quite different from this one and, if this global
matter is confirmed, I might have side effects on other projects.

The OWC seems to get there when you upgrade the app to a new version
of Access. Now this may have happened a while ago and you never
noticed.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top