Results 1 to 12 of 12
  1. #1
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172

    Run-time error 3075

    I am trying to filter a subform from an unbound text box on the main form by clicking a button. The code on the button is:



    Private Sub btnLike_Click()
    Dim strWhatEver As String
    strWhatEver = Forms![frmLookupIngredients]![tbLike]
    Form_sfLookupIngredients.Filter = "[fStrSidesIngredients] like *'" & strWhatEver & "'*"
    Forms_fLookupIngredients.FilterOn = True
    End Sub

    When run, I get the following error. Any help is appreciated.


  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    You need to post the error message lest others don't be bothered to look it up (there are thousands of them -too many to remember). I didn't look up that number but I suspect your subform reference is wrong:
    [Forms]![Main form name]![subform control name].[Form]![control name on subform]

    subform control name is the name of the subform control, which may not be the same as the subform itself.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    http://access.mvps.org/access/forms/frm0031.htm

    I'll look it up just this once.

    https://support.microsoft.com/en-us/...2-a9deafee16db


    Run-Time Error 3075: Syntax Error (Missing Operator) in Query Expression ID () and Link LIKE 'SET'

    Try
    Code:
     "[fStrSidesIngredients] like '*" & strWhatEver & "*'"
    I would also think you need SubformControlName.form.filter etc?
    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

  4. #4
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    I pasted the whole error message but I did not realize that only the top line of it showed up. I changed my code to:
    Forms![frmLookuoIngredients]![sfLookupIngredients].[Form]![fStrSidesIngredients] like '*" & strWhatEver & "*'"

    Access wants an equal sign '=' instead of 'like'. I am sure I need another quote mark somewhere but I don't know where. Please help!

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Quote Originally Posted by lawdy View Post
    I pasted the whole error message but I did not realize that only the top line of it showed up. I changed my code to:
    Forms![frmLookuoIngredients]![sfLookupIngredients].[Form]![fStrSidesIngredients] like '*" & strWhatEver & "*'"

    Access wants an equal sign '=' instead of 'like'. I am sure I need another quote mark somewhere but I don't know where. Please help!
    You have gone from a filter to a control? that is why it wants an = sign.
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Please review this updated code. You want to turn the filter on in the subform not the main form and the previous replies were attempting to make you reference the subform control correctly which you seemed to have done in post #4 but in a wrong context.
    Code:
    
    Private Sub btnLike_Click()
    Dim strWhatEver As String
    strWhatEver = Forms![frmLookupIngredients]![tbLike]
    
    
    'your original lines
    'Forms![frmLookuoIngredients]![sfLookupIngredients].[Form]![fStrSidesIngredients] like '*" & strWhatEver & "*'"
    'Form_sfLookupIngredients.Filter = "[fStrSidesIngredients] like *'" & strWhatEver & "'*"
    'Forms_fLookupIngredients.FilterOn = True
    
    
    Forms![frmLookuoIngredients]![sfLookupIngredients].Form.Filter= "[fStrSidesIngredients] like '*" & strWhatEver & "*'"
    Forms![frmLookuoIngredients]![sfLookupIngredients].Form.FilterOn = True
    End Sub
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    this is a form? fStrSidesIngredients Then this is 2 references to the same thing - so not right: [Form]![fStrSidesIngredients]

    WGM, I'm not seeing a transition from a filter to a control?
    I am trying to filter a subform from an unbound text box
    Perhaps
    Forms![frmLookuoIngredients]![sfLookupIngredients]![Form].Filter = Me.tbLike

    You can't say form filter is "dog". You have to say formreferencHere.filter = "myField = 'dog'" (note delimited text within double quotes)
    or if numeric then formreferenceHere.filter = "myField = 1234"
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    Ok, I re did my code by coping yours and I had misspelled the main form name. So it looks like the following:

    Private Sub btnLike_Click()
    Dim strWhatEver As String
    strWhatEver = Forms![frmLookupIngredients]![tbLike]


    Forms![frmLookupIngredients]![sfLookupIngredients].Form.Filter = "[fStrSidesIngredients] like *'" & strWhatEver & "'*"
    Forms![frmLookupIngredients]![sfLookupIngredients].Form.FilterOn = True

    End Sub

    Now I get the following message:

    Run-Time Error 3075: Syntax Error (Missing Operator) in Query Expression ID () and Link LIKE 'SET'

    Symptoms

    "Runtime Error 3075: Syntax Error (missing operator) in query expression ID () and Link LIKE 'SET'"This error occurs when exporting a row format to a .tdb file.
    Cause

    Exporting a row format that includes Account Sets, and one or more of the accounts sets is invalid or empty.
    Resolution

    Delete the problematic Account Set from the row format, or correct the Account Set problem by verifying that it exists and that valid accounts are listed. For additional information on working with Accounts Sets, please see How to Create Account Sets in FRx.

    Please help and thanks for your patience.

  9. #9
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    The single quotes are wrong, need to be before and after *
    Forms![frmLookupIngredients]![sfLookupIngredients].Form.Filter = "[fStrSidesIngredients] like
    '*" & strWhatEver & "*'"

    And
    fStrSidesIngredients is a field on the subform, right?
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #10
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    Thank you very much. That worked

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    @lawdy, you will help yourself months from now if you have to troubleshoot, and likely anyone experienced in Access object names as well if you adopt a naming convention that is more recognizable. For example, I use prefixes like these
    frm for forms (frmMain), rptReportName
    sfm or sfrm for subforms, srtxtbox, lstbox, cmdButton, sfc for subformControlName
    and never do I use the same name for a control and the field it is bound to. That is what you get by using the wizard, so if I use that, I rename all form controls.

    See
    Naming conventions
    http://access.mvps.org/access/general/gen0012.htm
    https://www.access-programmers.co.uk...d.php?t=225837

    What not to use in names
    http://allenbrowne.com/AppIssueBadWord.html

    Please post more than a few lines of code withing code tags to maintain indentation and readability.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 14
    Last Post: 12-24-2021, 02:28 AM
  2. Replies: 6
    Last Post: 02-03-2020, 07:09 PM
  3. Replies: 13
    Last Post: 05-31-2019, 10:48 PM
  4. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

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