Solved

Getting Undefined Function error in MS Access

Posted on 2014-09-03
4
465 Views
Last Modified: 2014-09-03
I have an MS Access 2010 application that I deploy as an accdr file along with Access 2010 runtime.
At startup in this application I need to determine if the application is being run by someone remotely on my Terminal Server.  The computer name of the terminal server is "RDS01"
The line of code to check this is as follows:

         If Environ("computername") = "RDS01" Then

When the application is run on any computer other than my Terminal Server the line executes properly, determining the name of the computer.
But, when the application is run on my Terminal Server this line of code fails with the following message:

      Undefined function 'Environ' in expression

Can someone tell me why this is happening?
0
Comment
Question by:dsoderstrom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 40301905
Is the DB in a Trusted Location ?
And meanwhile, I suggest you not use Environ() and instead use the standard Windows API call - which will not have this issue:

Get Computer Name
http://access.mvps.org/access/api/api0009.htm

mx
0
 
LVL 58
ID: 40301907
<<Can someone tell me why this is happening? >>

 More than likely, the bane of VBA code writers; a broken reference.

 VBA relies on a reference list (with the VBA editor open, tools/references).   If a reference is "bad", than the VBA project won't run.

 What you'll need to do is add code like that found here:

IsBroken Property [Access 2003 VBA Language Reference]
http://msdn.microsoft.com/en-us/library/office/aa196149%28v=office.11%29.aspx

 or get a full install of Access on there with a DB not in runtime mode.

 You also might be able to figure it out from the reference list.  Look for non-standard ones you may have used.   If your lucky, you haven't used them in the app and can un-check, compile, and save and you'll be set.

 If you have used something, you'll need to figure out how to get it installed for your app or a way not to use it.

Jim.
0
 

Author Closing Comment

by:dsoderstrom
ID: 40302125
The Windows API call was exactly what I was looking for and if fixed the problem.
It also led me to another API call for determining the user login name which I was also using the environ function to retrieve.
Everything works perfectly now.  Thank You.
0
 
LVL 75
ID: 40302253
You are welcome .
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question