Error Message: "Undefined function "Date" in expression"

Discussion in 'Microsoft Access Form Coding' started by Archidrb, Mar 11, 2009.

  1. Archidrb

    Archidrb Guest

    This morning users in my database started getting this message hen opening
    the database. I use an autoexec command to start the database and open a
    (splash scrren). This form that opens shows the most up to date version
    number, so I know right there the ODBC connection to the SQL Server backend
    is working. Then when that form closes the main menu opens.

    As part of the main menu, a bit of code goes out and grabs the user's LAN ID
    and populates it into a hidden field on the main menu. This field then
    allows the user to update records and their name automatically populates.
    This name also limits access to certain bits of the database using macros.

    Each users gets this error four times, then the VBA de-bugging window opens
    and the code attached to this LAN ID process opens. It highlights the line
    containing the name of the function - which of course had not to do with a
    'Date'.

    Here is the code, I removed the (green) notes to save space and reading time.


    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    Function fOSUserName() As String
    Dim lngLen As Long, lngX As Long
    Dim strUserName As String
    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If (lngX > 0) Then
    fOSUserName = Left$(strUserName, lngLen - 1)
    Else
    fOSUserName = vbNullString
    End If
    End Function

    Did Microsoft release an update or hotfix that is causing this problem? Any
    other ideas?
     
    Archidrb, Mar 11, 2009
    #1
    1. Advertisements

  2. Archidrb

    Archidrb Guest

    Sorry, Office (Access) 2003, Windows XP-Pro 2002 SP2

    "ruralguy via AccessMonster.com" wrote:

    > You did not mention what version of Access you are using nor the OS in play.
    >
    > Archidrb wrote:
    > >This morning users in my database started getting this message hen opening
    > >the database. I use an autoexec command to start the database and open a
    > >(splash scrren). This form that opens shows the most up to date version
    > >number, so I know right there the ODBC connection to the SQL Server backend
    > >is working. Then when that form closes the main menu opens.
    > >
    > >As part of the main menu, a bit of code goes out and grabs the user's LAN ID
    > >and populates it into a hidden field on the main menu. This field then
    > >allows the user to update records and their name automatically populates.
    > >This name also limits access to certain bits of the database using macros.
    > >
    > >Each users gets this error four times, then the VBA de-bugging window opens
    > >and the code attached to this LAN ID process opens. It highlights the line
    > >containing the name of the function - which of course had not to do with a
    > >'Date'.
    > >
    > >Here is the code, I removed the (green) notes to save space and reading time.
    > >
    > >Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    > > "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    > >
    > >Function fOSUserName() As String
    > >Dim lngLen As Long, lngX As Long
    > >Dim strUserName As String
    > > strUserName = String$(254, 0)
    > > lngLen = 255
    > > lngX = apiGetUserName(strUserName, lngLen)
    > > If (lngX > 0) Then
    > > fOSUserName = Left$(strUserName, lngLen - 1)
    > > Else
    > > fOSUserName = vbNullString
    > > End If
    > >End Function
    > >
    > >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >other ideas?

    >
    > --
    > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > Please post back to this forum so all may benefit.
    >
    > Message posted via AccessMonster.com
    > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    >
    >
     
    Archidrb, Mar 11, 2009
    #2
    1. Advertisements

  3. Archidrb

    Archidrb Guest

    I should also mention that I am not having this problem, but four of my end
    users are.

    "ruralguy via AccessMonster.com" wrote:

    > You did not mention what version of Access you are using nor the OS in play.
    >
    > Archidrb wrote:
    > >This morning users in my database started getting this message hen opening
    > >the database. I use an autoexec command to start the database and open a
    > >(splash scrren). This form that opens shows the most up to date version
    > >number, so I know right there the ODBC connection to the SQL Server backend
    > >is working. Then when that form closes the main menu opens.
    > >
    > >As part of the main menu, a bit of code goes out and grabs the user's LAN ID
    > >and populates it into a hidden field on the main menu. This field then
    > >allows the user to update records and their name automatically populates.
    > >This name also limits access to certain bits of the database using macros.
    > >
    > >Each users gets this error four times, then the VBA de-bugging window opens
    > >and the code attached to this LAN ID process opens. It highlights the line
    > >containing the name of the function - which of course had not to do with a
    > >'Date'.
    > >
    > >Here is the code, I removed the (green) notes to save space and reading time.
    > >
    > >Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    > > "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    > >
    > >Function fOSUserName() As String
    > >Dim lngLen As Long, lngX As Long
    > >Dim strUserName As String
    > > strUserName = String$(254, 0)
    > > lngLen = 255
    > > lngX = apiGetUserName(strUserName, lngLen)
    > > If (lngX > 0) Then
    > > fOSUserName = Left$(strUserName, lngLen - 1)
    > > Else
    > > fOSUserName = vbNullString
    > > End If
    > >End Function
    > >
    > >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >other ideas?

    >
    > --
    > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > Please post back to this forum so all may benefit.
    >
    > Message posted via AccessMonster.com
    > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    >
    >
     
    Archidrb, Mar 11, 2009
    #3
  4. Archidrb

    Archidrb Guest

    SQL Server backend connected using ODBC. I have a design master that is
    replicated to a "master replica", then each user has their own copy (replica)
    of the front end made from the master replica. This way I can make
    structural changes, synch to the master replica, then each user can
    synchronize the changes.

    "ruralguy via AccessMonster.com" wrote:

    > Is your application split FrontEnd and BackEnd and does everyone have their
    > own copy of the FrontEnd? Or is this not a MultiUser application? Are the
    > users using MDE or MDB? Are there any reference errors that have cropped up?
    >
    > Archidrb wrote:
    > >I should also mention that I am not having this problem, but four of my end
    > >users are.
    > >
    > >> You did not mention what version of Access you are using nor the OS in play.
    > >>

    > >[quoted text clipped - 34 lines]
    > >> >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >> >other ideas?

    >
    > --
    > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > Please post back to this forum so all may benefit.
    >
    > Message posted via http://www.accessmonster.com
    >
    >
     
    Archidrb, Mar 12, 2009
    #4
  5. Archidrb

    Archidrb Guest

    MDB's.

    The error says "Undefined function 'Date' in expression". It pops-up four
    times upon opening the database, then the VBA code debug window opens to the
    code that runs to paste the users LAN ID onto the main menu. Then closing
    the debugger allows the database to open, but the name does not paste.

    I know that the SQL Server backend is connecting because there is a splash
    form that comes up first showing the version of the database. The version is
    stored in a SQL table in the backend. So whatever is causing the problem
    occurs after the ODBC has opened/connected.



    "ruralguy via AccessMonster.com" wrote:

    > MDE or MDB's? Any there any Reference errors, bogus or otherwise?
    >
    > Archidrb wrote:
    > >SQL Server backend connected using ODBC. I have a design master that is
    > >replicated to a "master replica", then each user has their own copy (replica)
    > >of the front end made from the master replica. This way I can make
    > >structural changes, synch to the master replica, then each user can
    > >synchronize the changes.
    > >
    > >> Is your application split FrontEnd and BackEnd and does everyone have their
    > >> own copy of the FrontEnd? Or is this not a MultiUser application? Are the

    > >[quoted text clipped - 8 lines]
    > >> >> >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >> >> >other ideas?

    >
    > --
    > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > Please post back to this forum so all may benefit.
    >
    > Message posted via AccessMonster.com
    > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    >
    >
     
    Archidrb, Mar 12, 2009
    #5
  6. Archidrb

    Archidrb Guest

    Here was the problem:

    On several (most) of the members of my team a Reference was missing. The
    reference was called "Microsoft Windows Common Controls-2 6.0 (SP6)".

    I had the reference on my laptop and it was located on my machine at:
    C:\Windows\System32\ and called MSCOMCT2.OCX

    Here's what I did:

    I made a copy of my OCX file to a network location, went to each affected
    user's machine and copied the file back to their System32 folder.

    I did not even need to go through all of the "Reference" steps in the link
    provided. As soon as the OCX file was replaced, the database worked.

    Thank you for your help!


    "ruralguy via AccessMonster.com" wrote:

    > Have you checked for any missing references?
    > http://www.accessmvp.com/djsteele/AccessReferenceErrors.html
    >
    > Archidrb wrote:
    > >MDB's.
    > >
    > >The error says "Undefined function 'Date' in expression". It pops-up four
    > >times upon opening the database, then the VBA code debug window opens to the
    > >code that runs to paste the users LAN ID onto the main menu. Then closing
    > >the debugger allows the database to open, but the name does not paste.
    > >
    > >I know that the SQL Server backend is connecting because there is a splash
    > >form that comes up first showing the version of the database. The version is
    > >stored in a SQL table in the backend. So whatever is causing the problem
    > >occurs after the ODBC has opened/connected.
    > >
    > >> MDE or MDB's? Any there any Reference errors, bogus or otherwise?
    > >>

    > >[quoted text clipped - 9 lines]
    > >> >> >> >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >> >> >> >other ideas?

    >
    > --
    > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > Please post back to this forum so all may benefit.
    >
    > Message posted via AccessMonster.com
    > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    >
    >
     
    Archidrb, Mar 12, 2009
    #6
  7. Archidrb

    Peter Hibbs Guest

    This may be due to a Windows Security update. I see that MSCOMCT2.OCX
    is one of the affected controls. Have a look at :-

    http://support.microsoft.com/kb/957924
    and
    http://www.microsoft.com/technet/security/advisory/960715.mspx

    Peter Hibbs.

    On Thu, 12 Mar 2009 08:12:02 -0700, Archidrb
    <> wrote:

    >Here was the problem:
    >
    >On several (most) of the members of my team a Reference was missing. The
    >reference was called "Microsoft Windows Common Controls-2 6.0 (SP6)".
    >
    >I had the reference on my laptop and it was located on my machine at:
    >C:\Windows\System32\ and called MSCOMCT2.OCX
    >
    >Here's what I did:
    >
    >I made a copy of my OCX file to a network location, went to each affected
    >user's machine and copied the file back to their System32 folder.
    >
    >I did not even need to go through all of the "Reference" steps in the link
    >provided. As soon as the OCX file was replaced, the database worked.
    >
    >Thank you for your help!
    >
    >
    >"ruralguy via AccessMonster.com" wrote:
    >
    >> Have you checked for any missing references?
    >> http://www.accessmvp.com/djsteele/AccessReferenceErrors.html
    >>
    >> Archidrb wrote:
    >> >MDB's.
    >> >
    >> >The error says "Undefined function 'Date' in expression". It pops-up four
    >> >times upon opening the database, then the VBA code debug window opens to the
    >> >code that runs to paste the users LAN ID onto the main menu. Then closing
    >> >the debugger allows the database to open, but the name does not paste.
    >> >
    >> >I know that the SQL Server backend is connecting because there is a splash
    >> >form that comes up first showing the version of the database. The version is
    >> >stored in a SQL table in the backend. So whatever is causing the problem
    >> >occurs after the ODBC has opened/connected.
    >> >
    >> >> MDE or MDB's? Any there any Reference errors, bogus or otherwise?
    >> >>
    >> >[quoted text clipped - 9 lines]
    >> >> >> >> >Did Microsoft release an update or hotfix that is causing this problem? Any
    >> >> >> >> >other ideas?

    >>
    >> --
    >> RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    >> Please post back to this forum so all may benefit.
    >>
    >> Message posted via AccessMonster.com
    >> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    >>
    >>
     
    Peter Hibbs, Mar 12, 2009
    #7
  8. Archidrb

    Archidrb Guest

    Thanks, Peter. I forwarded these links to my friend in the IT department
    that is involved in rolling out this patch/upgrade. I suspect there is
    nothing they can do to keep from having to reinstall this OCX file on (many)
    user's machines.

    And a big thanks to Ruralguy for helping point me to the problem. I love
    solving problems and I needed a place to start!


    "Peter Hibbs" wrote:

    >
    > This may be due to a Windows Security update. I see that MSCOMCT2.OCX
    > is one of the affected controls. Have a look at :-
    >
    > http://support.microsoft.com/kb/957924
    > and
    > http://www.microsoft.com/technet/security/advisory/960715.mspx
    >
    > Peter Hibbs.
    >
    > On Thu, 12 Mar 2009 08:12:02 -0700, Archidrb
    > <> wrote:
    >
    > >Here was the problem:
    > >
    > >On several (most) of the members of my team a Reference was missing. The
    > >reference was called "Microsoft Windows Common Controls-2 6.0 (SP6)".
    > >
    > >I had the reference on my laptop and it was located on my machine at:
    > >C:\Windows\System32\ and called MSCOMCT2.OCX
    > >
    > >Here's what I did:
    > >
    > >I made a copy of my OCX file to a network location, went to each affected
    > >user's machine and copied the file back to their System32 folder.
    > >
    > >I did not even need to go through all of the "Reference" steps in the link
    > >provided. As soon as the OCX file was replaced, the database worked.
    > >
    > >Thank you for your help!
    > >
    > >
    > >"ruralguy via AccessMonster.com" wrote:
    > >
    > >> Have you checked for any missing references?
    > >> http://www.accessmvp.com/djsteele/AccessReferenceErrors.html
    > >>
    > >> Archidrb wrote:
    > >> >MDB's.
    > >> >
    > >> >The error says "Undefined function 'Date' in expression". It pops-up four
    > >> >times upon opening the database, then the VBA code debug window opens to the
    > >> >code that runs to paste the users LAN ID onto the main menu. Then closing
    > >> >the debugger allows the database to open, but the name does not paste.
    > >> >
    > >> >I know that the SQL Server backend is connecting because there is a splash
    > >> >form that comes up first showing the version of the database. The version is
    > >> >stored in a SQL table in the backend. So whatever is causing the problem
    > >> >occurs after the ODBC has opened/connected.
    > >> >
    > >> >> MDE or MDB's? Any there any Reference errors, bogus or otherwise?
    > >> >>
    > >> >[quoted text clipped - 9 lines]
    > >> >> >> >> >Did Microsoft release an update or hotfix that is causing this problem? Any
    > >> >> >> >> >other ideas?
    > >>
    > >> --
    > >> RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    > >> Please post back to this forum so all may benefit.
    > >>
    > >> Message posted via AccessMonster.com
    > >> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200903/1
    > >>
    > >>

    >
     
    Archidrb, Mar 12, 2009
    #8
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ronald W. Roberts

    Undefined Function "DIR" in expression

    Ronald W. Roberts, Nov 6, 2003, in forum: Microsoft Access Form Coding
    Replies:
    2
    Views:
    303
    Ronald W. Roberts
    Nov 7, 2003
  2. Bridget

    undefined function 'date' in expression - Still not solved!

    Bridget, Dec 2, 2003, in forum: Microsoft Access Form Coding
    Replies:
    3
    Views:
    224
    bridget
    Dec 2, 2003
  3. damonj

    Undefined Function Now() in query

    damonj, Jun 15, 2006, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    202
    fredg
    Jun 15, 2006
  4. Guest

    undefined function 'left' in expression.

    Guest, Jul 10, 2006, in forum: Microsoft Access Form Coding
    Replies:
    4
    Views:
    189
    Stefan Hoffmann
    Jul 10, 2006
  5. Harlan

    Undefined function 'fGetGroupName' in expression

    Harlan, Oct 31, 2006, in forum: Microsoft Access Form Coding
    Replies:
    2
    Views:
    138
    Harlan
    Oct 31, 2006
Loading...

Share This Page