Tracking Down Cause of "The expression is typed incorrectly, or it is too complex to be evaluated." Error When Opening a Form

Carla M Romere 96 Reputation points
2021-08-09T15:40:46.53+00:00

I have a basic form with a few combobox and listbox selectors. Once all of the information has been completed, it shows two subforms based on the selection criteria. The issue that I have currently is when I open the main form, I get two instances of this error "The expression is typed incorrectly, or it is too complex to be evaluated."

However, if I just click cancel on the two error messages, the form opens fine and works as expected. The two subforms are displayed and function correctly. How can I track down what is causing the two error messages? I suspect it has to do with the subforms, but I can't find anything wrong with them.

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
883 questions
0 comments No comments
{count} votes

Accepted answer
  1. Carla M Romere 96 Reputation points
    2021-08-09T17:13:29.403+00:00

    @Ken Sheridan - I hadn't thought of that issue since it was a new form. So I tried that, and it does the same exact thing.
    So there is nothing in the Form Load event for the main form at all and there is no record source on the main form.
    First task is select a company from a combo box. That fires the After Update event. That event shows a textbox populated and then shows a ListBoxto select a sub-company from. That fires the After Update event from the ListBoxwhen then shows another ListBoxwith multiple orders listed. Once the user selects a specific order in the last ListBox, then the two subforms become visible and show the data for the selected order in the ListBox.

    I'm just stumped as to what I have done incorrectly. I'll include my code here in case there is something that I'm completely missing.

    Main ComboBox to select the company (cboCustomers)
    Second selection is a ComboBox (cboNatlAccounts)
    Third selection is to select a specific order (listFreightTerms)
    That is all the code involved in this form.

            Private Sub cboCustomers_AfterUpdate()  
                NationalAccounts_Label.Visible = True  
                Me.cboNatlAccounts = Null  
                Me.cboNatlAccounts.Visible = True  
                cboNatlAccounts.Requery  
                Me.listFreightTerms = Null  
                  
                QuoteDate_Textbox.Visible = False  
                QuoteDate_Label.Visible = False  
                  
                lblQuoteID.Visible = False  
                QuoteID_Textbox.Visible = False  
                  
                CompanyID_Label.Visible = True  
                CompanyID_txtbox.Visible = True  
                CompanyID_txtbox.Requery  
                  
                listFreightTerms.Visible = False  
                frmModQuotes.Visible = False  
                frmModQuoteDetail.Visible = False  
              
            End Sub  
      
    Private Sub cboNatlAccounts_AfterUpdate()  
        lblFreightTerms.Visible = True  
        listFreightTerms.Visible = True  
        listFreightTerms.Requery  
        Me.listFreightTerms = Null  
          
    End Sub  
      
    Private Sub listFreightTerms_AfterUpdate()  
        frmModQuotes.Visible = True  
        frmModQuoteDetail.Visible = True  
          
        QuoteDate_Textbox.Visible = True  
        QuoteDate_Label.Visible = True  
        QuoteDate_Textbox.Requery  
          
        QuoteID_Textbox.Visible = True  
        lblQuoteID.Visible = True  
        QuoteID_Textbox.Requery  
          
        Me.frmModQuotes.Form.Filter = "[QuoteID]=" & Me.listFreightTerms.Value  
        Me.frmModQuotes.Form.FilterOn = True  
        frmModQuotes.Requery  
          
        Me.frmModQuoteDetail.Form.Filter = "[QuoteID]=" & Me.listFreightTerms.Value  
        Me.frmModQuoteDetail.Form.FilterOn = True  
        frmModQuoteDetail.Requery  
      
    End Sub  
      
    

2 additional answers

Sort by: Most helpful
  1. Ken Sheridan 2,841 Reputation points
    2021-08-09T16:54:35.793+00:00

    It might be that the form is corrupted. Try selecting the main form in the navigation pane and then copying it to the clipboard with Ctrl+C. Then paste it back under a new name with Ctrl+V. Does the copy of the form then open without error? If so, you can delete the original and rename the copy back to the original name. I've lost count of the number of times this has worked for me.

    0 comments No comments

  2. Carla M Romere 96 Reputation points
    2021-08-10T13:43:01.647+00:00

    Well, oddly enough, that tactic worked. I pasted each object individually into a new form, and ran it, and don't receive any errors now. Thanks for the tip!!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.