Share via

query using forms - too many parameters?

Anonymous
2013-02-11T22:18:24+00:00

I am attempting to make a form for our geologist to run queries on a database.  I have figured out using my very limited knowledge how to put this form together and access data ... but as I add more options to the query (you can check a box to say you want that data included in the query) I start getting errors saying things are too complex.  Is there a limit or am I doing something wrong?

For example, I have a field called [cut] and they can query it based on a value chosen in a listbox and the query will grab all values equal and greater to that value.  I also want to add the same thing for a field called [cuas] and when I do it says the query is too complex.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2013-02-11T23:53:43+00:00

    From your field names it seems like you have a spreadsheet layout rather than a relational database.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-02-11T23:39:32+00:00

    [cut] seems to work without [cuas]

    cut and cuas are both columns in our database

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-02-11T23:35:17+00:00

    I do not know VBA but is 'cut' the one that is also a problem?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-02-11T23:05:21+00:00

    This is not going to be easy because it is partially code in the layout view and partially code in VB

    I have the following fields so far where the geologist can pick restrictions (he clicks a box and the query knows to include that in the query):

     formation   

    Like IIf([forms]![block model]![check_formation]=-1,[forms]![block model]![formation],"*")

    oxzone  

    Like IIf([forms]![block model]![check_oxide]=-1,[forms]![block model]![oxzone],"*")

    cut    

    [Northstar_mod_feb2013].[cut]>=IIf([Forms]![Block Model]![check_grade]=-1,[Forms]![Block Model]![cut],"*")

    class    

    Like IIf([forms]![block model]![check_class]=-1,[forms]![block model]![class],"*")

    and my vb code is the following:

    Option Compare Database

    Private Sub check_class_Click()

    If check_class.Value = -1 Then 'Checked

         Class_Label.Visible = True

         Class_Textbox.Visible = True

    Else

         Class_Label.Visible = False

         Class_Textbox.Visible = False

    End If

    End Sub

    Private Sub check_oxide_Click()

    If check_oxide.Value = -1 Then 'Checked

         Oxzone_Label.Visible = True

         OxZone_Textbox.Visible = True

    Else

         Oxzone_Label.Visible = False

         OxZone_Textbox.Visible = False

    End If

    End Sub

    Private Sub check_grade_Click()

    If check_grade.Value = -1 Then 'Checked

         TCu_Grade_Label.Visible = True

         Tcu_Textbox.Visible = True

    Else

         TCu_Grade_Label.Visible = False

         Tcu_Textbox.Visible = False

    End If

    End Sub

    Private Sub check_formation_Click()

    If check_formation.Value = -1 Then 'Checked

         Formation_Label.Visible = True

         Formation_Textbox.Visible = True

    Else

         Formation_Label.Visible = False

         Formation_Textbox.Visible = False

    End If

    End Sub


    This all works.  But when I try to add cuas it says "This expression is typed incorrectly, or it is too complex to be evaluated.  For example, a numeric expression may contain too many complicated elements.  Try simplifying the expression by assigning parts of the expression to variables.

    The code for cuas (or ascu)

    [Northstar_mod_feb2013].[cuas]>=IIf([Forms]![Block Model]![check_ascu]=-1,[Forms]![Block Model]![cuas],"*")

    and

    Private Sub check_ascu_Click()

    If Check_Ascu.Value = -1 Then 'Checked

         cuas_grade_label.Visible = True

         cuas_Textbox.Visible = True

    Else

         cuas_grade_label.Visible = False

         cuas_Textbox.Visible = False

    End If

    End Sub


    I am also having a problem with another one but I will tackle one at a time.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-02-11T22:43:53+00:00

    Access is not human so it's response is what it think is wrong. It could be that adding the additional field is not the problem but some error in syntax.

    Post the SQL of your query and bold that part you added and then it gave the error.

    Was this answer helpful?

    0 comments No comments