Results 1 to 3 of 3
  1. #1
    neo651 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    110

    The expression you entereed has a function name that Microsoft Access can't find.

    I have a database for which I've created a main form that has a sub form in it as a datasheet. The sub form is based on a query and a criteria of that query is set by a combo box in the main form. It seemed like a pretty simple idea but when I put it all together and open the main form as soon as I select something other than the default in the combo box I get this error:



    The expression you entereed has a function name that Microsoft Access can't find.

    I think get a macro error screen. I have an embedded macro in the On Change field of the combo box. One of the actions of the macro is RunCode and it runs DelayTime(1). The macro error screen cites this as the point of failure and lists Error Number 2950.

    I recreated that form and it's required objects in a completely separate sample database to rule out data corruption as the issue (that database is attached). I've also confirmed that there are no missing VBA References and set the location of the database as a Trusted Location.

    In the sample databae I have tblTable and tblGroups. Data in tblTable belongs to one of two groups. qryTable has the criteria of the Group field set to take the input from cboGroup in frmMain. frmSub is a datasheet based on qryTable and is inside of frmMain. The macro opens the subforms, waits 1 second, requeries qryTable, repaints frmSub and then closes frmSub.

    Please advise.Combox Box as Datasheet Source Query Criteria.zip

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    I don't use macros and couldn't make sense of that one so I converted it to VBA and this is the result:
    Code:
    '------------------------------------------------------------
    ' cboGroup_Change
    '
    '------------------------------------------------------------
    Private Sub cboGroup_Change()
    On Error GoTo cboGroup_Change_Err
        Call DelayTime(1)
        DoCmd.OpenForm "frmSub", acNormal, "", "", , acNormal
        DoCmd.Requery "frmTable_DtSht"
        DoCmd.RepaintObject acForm, "frmTable_DtSht"
        DoCmd.Close acForm, "frmTable_DtSht"
        ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
        ' <UserInterfaceMacro For="cboGroup" Event="OnChange" xmlns="http://schemas.microsoft.com/office/...11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/
        ' _AXL:2009/11/forms"><Statements><Action Name="RunCode"><Argument Name="FunctionName">DelayTime(1)</Argument></Action><Action Name="OpenForm"><Argument Name="FormName">frmSub</Argument></Action><Action Name="Requery"><Argument Name="ControlName">frmTable
        ' _AXL:_DtSht</Argument></Action><Action Name="RepaintObject"><Argument Name="ObjectType">Form</Argument><Argument Name="ObjectName">frmTable_DtSht</Argument></Action><Action Name="CloseWindow"><Argument Name="ObjectType">Form</Argument><Argument Name="Ob
        ' _AXL:jectName">frmTable_DtSht</Argument></Action></Statements></UserInterfaceMacro>
    
    cboGroup_Change_Exit:
        Exit Sub
    cboGroup_Change_Err:
        MsgBox Error$
        Resume cboGroup_Change_Exit
    End Sub
    I get compile error on: Call DelayTime(1)

    There is no function DelayTime().
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    DelayTime is not a built in function, so it's something you perhaps forgot to copy from wherever you got it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 05-04-2019, 09:02 PM
  2. Replies: 9
    Last Post: 06-08-2012, 07:52 AM
  3. Replies: 1
    Last Post: 09-03-2011, 07:01 PM
  4. Replies: 6
    Last Post: 10-30-2010, 08:42 AM
  5. Replies: 1
    Last Post: 09-09-2009, 04:42 AM

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