Results 1 to 9 of 9
  1. #1
    Pada is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2023
    Posts
    22

    Expr1 Name Issue when using Filter

    I have a form, form1 with a record source say query1. In the query1, I added a Trim function for a field named Series, so the Expr1 showing up for that field name. On form1 has a button Filter when clicked will open another form, form2. On form2 there is a combo box allow use to select a specific series and this series will be passed back to form1 that filter data to display all records that matches the selected Series only.


    The problem is now in the query1, the field Series is now Expr1 and therefore it is no longer match with the Series passed from form2. A dialog pops up asking for a Series parameter.
    Do you know how to fix this issue without taking out the Trim function. Thank you very much in advance. It is an urgent issue.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Unsure why you need to trim in one instance, but not another?

    You can rename Expr1 to anything you want other than the name of the field it is trimming.

    So just filter as normal except you will be using

    Expr1 = Series where Series is whatever is passed back from Form2.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Pada is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2023
    Posts
    22
    Thanks Welshgasman. I can't change Expr1 to Series. If I do that, it pops up an error message saying "circular reference" meaning it doesn't accept the same name as the field Series.

  4. #4
    Pada is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2023
    Posts
    22

    Not-declared variable

    I have actually just tested by added something into the code of form2. When a user clicks on the combo box drop down and select a series and click the OK button, the code behind that event click button will check and assign Series = cboSeries.value. Now I change it from Series to Expr1 = cboSeries.value and it appears working. Question is do you think this is the right way to fix the parameter popping up? Thank you.
    I like to add. Even Expr1 is not declared in the form2 code, it looks like VBA still accept it. Is this a red flag for potential issue later?
    Last edited by Pada; 08-02-2023 at 07:35 AM. Reason: Adding more information

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by Pada View Post
    Thanks Welshgasman. I can't change Expr1 to Series. If I do that, it pops up an error message saying "circular reference" meaning it doesn't accept the same name as the field Series.
    That is what I said?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I would give it a more meaninful name?, TrimSeries perhaps?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Why not just pick the filter value from the same main form and then apply it?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Pada is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2023
    Posts
    22
    Yes, a more meaningful name is better, but it's still different with than the Series and it still pops up the dialog box asking for parameter Series

  9. #9
    Pada is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2023
    Posts
    22
    I am inherited this program and it is designed that way. Also, the form2 is for showing a list of several fields available to users to use whatever field they want to.

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

Similar Threads

  1. Expr1: Expr2: etc. appearing in queries
    By Gina Maylone in forum Access
    Replies: 8
    Last Post: 02-20-2018, 03:48 PM
  2. Replies: 8
    Last Post: 01-02-2015, 06:44 PM
  3. Form Filter/OrderBy Issue
    By Gray in forum Forms
    Replies: 2
    Last Post: 05-13-2011, 03:10 PM
  4. Yet another filter issue :(
    By ducecoop in forum Access
    Replies: 3
    Last Post: 10-29-2010, 10:00 AM
  5. Criteria or Filter Issue
    By MichaelW in forum Queries
    Replies: 1
    Last Post: 07-06-2010, 01:43 PM

Tags for this Thread

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