Space$ error ?

  • Thread starter Thread starter luis_a_roman via AccessMonster.com
  • Start date Start date
L

luis_a_roman via AccessMonster.com

I'm using Access 2002. I have the following code:
Option Compare Database
' Declare for call to mpr.dll.
Declare Function WNetGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As Long
Public newName, eMail, copy As String
Public assignee, lpassigneename, issue, comment As String
Public ctrlname As String
Const NoError = 0 'The Function call was successful

Sub GetUserName()
Const lpnLength As Integer = 255
Dim Status As Integer
Dim lpName, lpUserName As String
lpUserName = Space$(lpnLength + 1)
Status = WNetGetUser(lpName, lpUserName, lpnLength)
If Status = NoError Then
' This line removes the null character. Strings in C are null-


However, when I execute the code, it says that Space$ is not defined. Can
anyone help me with this problem? It seems to me that I'm missing some
refernce library but don't know which one.

Help or guidance will be appreciated.

Luis
 
Access is probably lying to you. Click on Alt-F11 and go into Tools,
References. In there, you will probably find a library near the top marked
with the word "MISSING:" in front of it. That's the one that's causing the
problems.


Rob
 
Back
Top