Use text box to call Function

W

Wobble

Hi there

I created a module using the code from here:
http://www.mvps.org/access/api/api0008.htm and created a text box on a form
and changed the Control Source to =fOSUserName().

When I do this, the text box returns #Name?

Can anyone tell me what I've done wrong and how to correct it?

Much appreciated
Paul
 
T

Tom Wickerath

Hi Paul,

I just tried this out, and it works fine for me. Have you checked for any
missing references?

Solving Problems with Library References (Allen Browne)
http://allenbrowne.com/ser-38.html

Access Reference Problems (Doug Steele)
http://www.accessmvp.com/djsteele/AccessReferenceErrors.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi there

I created a module using the code from here:
http://www.mvps.org/access/api/api0008.htm and created a text box on a form
and changed the Control Source to =fOSUserName().

When I do this, the text box returns #Name?

Can anyone tell me what I've done wrong and how to correct it?

Much appreciated
Paul
 
W

Wobble

Hi Tom

I thought the dll was a standard OS dll?

I don't know what library's I'm supposed to reference, unfortunately. Could
you tell me which ones you use and I can try them out?

Thanks
Paul

Hi Paul,

I just tried this out, and it works fine for me. Have you checked for any
missing references?

Solving Problems with Library References (Allen Browne)
http://allenbrowne.com/ser-38.html

Access Reference Problems (Doug Steele)
http://www.accessmvp.com/djsteele/AccessReferenceErrors.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi there

I created a module using the code from here:
http://www.mvps.org/access/api/api0008.htm and created a text box on a form
and changed the Control Source to =fOSUserName().

When I do this, the text box returns #Name?

Can anyone tell me what I've done wrong and how to correct it?

Much appreciated
Paul
 
A

Arvin Meyer [MVP]

The API used is a standard one, but reference problems can be caused by any
missing reference. The references that are normally standard are:

VBA
MS-Access (version)
OLE
Either ADO or DAO depending upon your version

If there is any reference that is undefined or ambiguous (like the ADO/DAO
one) you'll have the problem. Read the 2 articles that Tom posted for
specific information.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
T

Tom Wickerath

Hi Paul,

The file "advapi32.dll" is considered a Win 32 core component, so you should
have a copy of this .dll file on your PC:

http://support.microsoft.com/dllhelp/?dlltype=file&l=55&alpha=advapi32.dll&S=1&x=4&y=9

You don't need any special references. You just need to verify that you
don't have any references marked as "MISSING", because if you do, no VBA code
will run properly. Press ALT F11 to open the VBE editor. Click on Tools >
References. You should not see any references marked as MISSING. If you do,
you need to fix that problem.

Tom
__________________________________________

:

Hi Tom

I thought the dll was a standard OS dll?

I don't know what library's I'm supposed to reference, unfortunately. Could
you tell me which ones you use and I can try them out?

Thanks
Paul
__________________________________________


Hi Paul,

I just tried this out, and it works fine for me. Have you checked for any
missing references?

Solving Problems with Library References (Allen Browne)
http://allenbrowne.com/ser-38.html

Access Reference Problems (Doug Steele)
http://www.accessmvp.com/djsteele/AccessReferenceErrors.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi there

I created a module using the code from here:

http://www.mvps.org/access/api/api0008.htm and created a text box on a form
and changed the Control Source to =fOSUserName().

When I do this, the text box returns #Name?

Can anyone tell me what I've done wrong and how to correct it?

Much appreciated
Paul
 
W

Wobble

Hi Arvin and Tom

I have all items that you mention referenced.

Can I just check that what I am doing is correct?

I create a new module, insert the code as shown on the web page I mentioned
and saved it as fOSUserName.

In the properties for the text box, I insert, under 'Control Source' the
following: =fOSUserName()

Is this all I need to do, or have I done something wrong?

Thanks
Paul

The API used is a standard one, but reference problems can be caused by any
missing reference. The references that are normally standard are:

VBA
MS-Access (version)
OLE
Either ADO or DAO depending upon your version

If there is any reference that is undefined or ambiguous (like the ADO/DAO
one) you'll have the problem. Read the 2 articles that Tom posted for
specific information.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
D

Douglas J Steele

Rename the module from fOSUserName to something like mdlOSUserName.

Modules cannot be named the same as functions within them.
 
Top