Results 1 to 9 of 9
  1. #1
    DS928 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    8

    Undefined Function

    I am getting the message Undefined Function on this query.

    SELECT tblTerminal.TerminalID, tblTerminal.TerminalName, tblTerminal.TerminalAddress, tblTerminal.TerminalTypeID, tblTerminal.TerminalLocation
    FROM tblTerminal
    WHERE (((tblTerminal.TerminalName)=Environ("ComputerName ")));



    What could be causing this. I recently went from Access XP and XP to Access 2010 and Win 7 and Environ seems to be causing problems.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    does the query run without the WHERE clause?

    Code:
    SELECT tblTerminal.TerminalID, tblTerminal.TerminalName,  tblTerminal.TerminalAddress, tblTerminal.TerminalTypeID,  tblTerminal.TerminalLocation
    FROM tblTerminal
    If it does it may be that extra space in your ...=Envrion("ComputerName ")...

    query does work without the WHERE clause add a field to your query:

    ComputerName: environ("computername")

    and see if that runs

    if it does and correctly returns the computer name it's probably that space.

  3. #3
    DS928 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    8
    The query runs without the where clause..
    Checked the original. No space there. Only looks that way here.

    WHERE (((tblTerminal.TerminalName)=Environ("ComputerName ")));

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    did you put the Environ("ComputerName") into a field by itself to see if it's actually populating?

    I suspect it's not and you are missing a reference

    Can tell me which references you're currently using in your db (open a module window click tools, click references)

  5. #5
    DS928 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    8
    These are the references.

    Visual Basic For Applications
    Microsoft Access 14.0 Object Library
    OLE Automation
    Microsoft Office 14.0 Access databse engine Object Library

    I setup a messagebox and it is returning the name of the computer.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    Are you sure you're spelling environ right? the references you have should be fine for using the environ function.

    Your undefined function should be telling you which function it's choking on as well, maybe there's something else in there like a 'left' or 'right' function.

  7. #7
    DS928 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    8
    Nope spelling it right "Environ" Nothing else in there.

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    can you provide a sample of your database then, when the undefined function box come up is it saying 'environ' is the undefined function it's having a problem with?

  9. #9
    DS928 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    8
    Got it. Took it outta "sandbox mode" Now it's working fine. Thank you.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Undefined function 'chopit' in expression
    By Modify_inc in forum Access
    Replies: 8
    Last Post: 08-20-2012, 04:42 PM
  2. undefined function in query
    By mejia.j88 in forum Programming
    Replies: 8
    Last Post: 02-07-2012, 03:50 PM
  3. Undefined Function "Left" in Expression
    By krueck in forum Access
    Replies: 4
    Last Post: 09-30-2011, 10:50 AM
  4. Date() function undefined
    By Bruce in forum Queries
    Replies: 4
    Last Post: 07-28-2011, 04:53 PM
  5. Undefined error importing spreadsheet
    By kbremner in forum Import/Export Data
    Replies: 1
    Last Post: 10-23-2010, 05:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums