Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:19:46+00:00 2026-05-11T08:19:46+00:00

I am supporting an application which was running for the past 3 years. It

  • 0

I am supporting an application which was running for the past 3 years. It was developed completely in MS Access and written in VBA.

Suddenly the application is facing the mentioned error at the following lines:

DoCmd.OpenForm FormName:='frmNewPeerGroup', View:=acNormal, windowmode:=acWindowNormal, OpenArgs:=5 

FrmNewPeerGroup code

 Private Sub Form_Open(Cancel As Integer)      Dim lDept As Long, lDiv As Long      lType = OpenArgs 'Supplied by caller     lAssmtVer = 1 'Current     sName = ''     sDescription = ''     dtCreatedDate = Format(Now(), 'dd/mm/yyyy')     sCreatedBy = UCase(userPerms.NTLoginName)     lSupervisorID = userPerms.userID     lTeam = 0      With cmbBxType         .RowSourceType = 'Value List'         .RowSource = GetValueListDict(pgType)         .Value = lType         .Enabled = (OpenArgs = 1)     End With     With cmbBxVersion         .RowSourceType = 'Value List'         .RowSource = GetValueListDict(pgAssmtType)         .Value = lAssmtVer     End With      mgLogoDesc.Visible = False     txtBxCreatedDate.Value = dtCreatedDate     txtBxCreatedBy.Value = sCreatedBy      If OpenArgs = 5 Then         lTeam = oActiveAssmt.TeamID         lDept = GetParentID(aTeams(), CInt(lTeam))         lDiv = GetParentID(aDepts(), CInt(lDept))         With cmbBxDivision             .RowSourceType = 'Value List'             .RowSource = GetValueListArray(aDivs())             .Value = lDiv             .Enabled = False         End With         With cmbBxDepartment             .RowSourceType = 'Value List'             .RowSource = GetValueListArray(aDepts())             .Value = lDept             .Enabled = False         End With         With cmbBxTeam             .RowSourceType = 'Value List'             .RowSource = GetValueListArray(aTeams())             .Value = lTeam             .Enabled = False         End With     Else         With cmbBxDivision             .RowSourceType = 'Value List'             .RowSource = GetValueListArray(aDivs())             .Enabled = False         End With         cmbBxDepartment.Enabled = False         cmbBxTeam.Enabled = False     End If  End Sub 

Many instances of the DoCmd.OpenForm command are giving the error in a message box saying:

 The expression On Click you entered as the event property setting produced the following error: The OpenForm action was canceled.  - The expression may not result in the name of macro, the name of    a user-defined function, or [Event procedure]. - There may have been an error evaluating the function, event, or macro. 

This is the error message I am receiving.

My problem is, the same code was running around 3 years, but suddenly some updates to Microsoft or Office might be giving trouble to this code.

Did anyone come across this error in the past weeks? Please let me know what else we can do to make this work again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:19:47+00:00Added an answer on May 11, 2026 at 8:19 am

    I don’t know if this qualifies as an answer, but the code in that OnOpen event is dependent on a lot of outside functions. Specifically, the code is assigning value lists for the RowSources of a bunch of combo boxes. The immediate red flag that occurs to me is that non-SQL Rowsources have a finite length, and in Access 97, that limit was 2048 characters (in Access 2003, it’s 32,750 — don’t ask me why it’s that number!).

    So, the immediate thing I see is that perhaps what ever data drives the functions that create those value lists has begun to exceed 2048 characters in length.

    If that’s the actual answer, then you can write a callback function that will return the values in the arrays, and it won’t have the limitation on the returned length. You’d set the RowsourceType to the name of your callback function and leave the Rowsource property blank.

    An example of the callback function is found in the A97 help (though I can’t find the same example in the A2K3 help). In A97 help, you get there by searching for RowsourceType, and then in the help window, click on the link in the sentence reading ‘You can also set the RowSourceType property with a ____user-defined function____.’

    To check this out, you just need to find out the length of the string returned from GetValueListArray() by each of the arrays referenced in the OnOpen event.

    It also might be helpful to add an error handler to the OnOpen event, particularly given that there are so many outside dependencies in the code in that particular sub.

    And last of all, let me say that it looks like horrible programming. Most of this ought to be settable with default properties, seems to me. I also question that kind of dependency on OpenArgs with such an undocumented input value. What does ‘5’ mean? And what does ‘1’ mean? Is that documented somewhere? It’s just terrible, terrible code, in my opinion.

    I’d likely do this with a standalone class module instead, because that will be self-documenting in terms of what does what. You’d set a particular named property to 5 and that would control what the form gets from the class module methods for populating the combo boxes. It would all be in one place, and you could use a meaningful property name to make it clear what the values 5 and 1 represent. It’s particularly helpful to do this if you have the same kind of code in the OnOpen event of multiple forms. In that case, it’s a no-brainer to move it out of the form modules, and the only question is whether you put it in a regular module or in a standalone class module (as I’m suggesting).

    Anyway, perhaps none of this is on point, but it might give you some ideas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm supporting an existing application written by another developer and I have a question
I am having an application which has a UI module and other supporting services.
We have an application written in C language which interacts with Oracle database. This
Is it possible to have an App (running iOS4 on hardware supporting multi-tasking) which
I am looking at supporting multiple languages for an HTML5 application which does not
I'm supporting an application built on ESRI ArcObjects where the original developers are long
My ASP.NET application needs a number of supporting services to run periodically in the
Up to now in my application, I've been supporting all flavors of Windows from
I have a requirement to produce a prototype (running in a J2EE compatible application
I have been given the tasks of speccing a mobile application, which will need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.