Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compile error: Can't find project or library (Access 2000/SP3)

    Hello again,
    I'm trying to use Dev Ashish's "Get Login Name" in a form. I built the form using Windows XP and Access 2003. On the XP computer, it works fine; when I run the form (click a new record button) on a WIndows 2000 computer (with Access 2000 sp/3), I get an error: Compile error: Can't find project or library.
    The biggest difference (besides installed software) is that the XP computer is on a workgroup and the 2000 computer is on a domain.
    The code 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
    '
    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    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
    '******************** Code End **************************

    The line "Function fOSUserName() As String" (found on line 14) is highlighted in yellow and the word "String$" (found on line 18) is highlighted in dark blue.

    I hope I've given enough information to ask for help ... but not overloaded it either.

    Thank you for your time and help,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Compile error: Can't find project or library (Access 2000/SP3)

    Select tools | References... in the Visual Basic Editor. There are probably one or more MISSING references. If so, not which ones they are, then clear their check boxes and click OK. Try Debug | Compile <projectname>. You may get an error "User-defined type not defined"; if so, you will have to set a reference for the highlighted type.

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile error: Can't find project or library (Access 2000/SP3)

    Thank you Hans, but I don't really understand your suggestion.
    This is my first real project (without the outline of an instructor or book), so can you please tell me more about setting a reference? I went to Tools, and References was greyed out, so that tells me that I'm missing something that I need (ie: a reference), but I don't know how to set it, or even what I need to reference in the first place.
    Any further help is greatly appreciated. [img]/forums/images/smilies/smile.gif[/img]

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile error: Can't find project or library (Access 2000/SP3)

    Is this where you're looking?
    Charlotte

  5. #5
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile error: Can't find project or library (Access 2000/SP3)

    Ahhh ... I'm sorry. I was in the de######, which is not the same as viewing the code by itself. Once I opened just the VB editor, I was able to get to the references and ... found what was missing. It's working great now. Thank you both very much! [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •