Space$ error ?

  • Thread starter luis_a_roman via AccessMonster.com
  • 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
 
R

Robert Morley

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
 

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