Results 1 to 12 of 12
  1. #1
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91

    Can you check my code?

    Is my coding correct,

    If Not Form_002_Criteria.TxtPop.Value = "" Then


    ' Me.Filter = "[Criteria].[PopMin]='" & [Criteria].[PopMax]='" & Form_002_Criteria.TxtPop.Value & "'"
    ' Me.FilterOn = True

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    two rows are commented out and you have an if without an end, so not much to go on but I would say no, not correct.

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    And your filter doesn't make sense. Plus your test doesn't account for Null. This would be better:

    If Len(Form_002_Criteria.TxtPop.Value & vbNullString) > 0 Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    What would be the corrected version?

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    If you ask one sentence questions with minimal code and descriptions, don't expect anything more than a minimal response.

    Syntactically, your code is confusing so you need to explain what the filter supposed to do (other than 'filter') i.e. describe as a sentence and provide some example data and what outcome is required. Also what are the datatypes involved? where is the code? on a form? on a button/some other control click event.

  6. #6
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by Ajax View Post
    If you ask one sentence questions with minimal code and descriptions, don't expect anything more than a minimal response.

    Syntactically, your code is confusing so you need to explain what the filter supposed to do (other than 'filter') i.e. describe as a sentence and provide some example data and what outcome is required. Also what are the datatypes involved? where is the code? on a form? on a button/some other control click event.
    Why are you so aggressive? I am just what needs to be corrected that's, all. I did provide everything in that code. I just need to know what needs to be corrected.

  7. #7
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by ryder214 View Post
    Why are you so aggressive? I am just what needs to be corrected that's, all. I did provide everything in that code. I just need to know what needs to be corrected.
    The comment is a big help, but I don't understand where they begin and end. Can you correct the comments?

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    no - because I don't know what the code is supposed to do.

  9. #9
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by Ajax View Post
    no - because I don't know what the code is supposed to do.
    I thought you are a PRO? The text box suppose to filter based on a values from two field.

    Text box name = TxTPop
    Field names = PopMin and PopMax

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    I am a PRO, and if I don't understand something, I ask to get clarification. I provide my help for free and don't like to see my time wasted so I am going to disconnect from this thread since you are reluctant to provide the answers. If you want to pay me as a professional to get something done, happy to provide you with a quote.

  11. #11
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm also a PRO and I also couldn't understand what you were trying to accomplish. Being a pro doesn't mean being a mind reader. I gave you an answer here 10 days ago:

    https://www.accessforums.net/showthr...240#post413240
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    Me.Filter = "[Criteria].[PopMin]='" & [Criteria].[PopMax]='" & Form_002_Criteria.TxtPop.Value & "'"
    Me.Filter = "[Criteria].[PopMin]='" & [NEED VALUE FROM FIELD HERE] & "' OR " & "[Criteria].[PopMax]='" & Form_002_Criteria.TxtPop.Value & "'"

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

Similar Threads

  1. code check pllease
    By Jen0dorf in forum Access
    Replies: 3
    Last Post: 10-30-2017, 12:34 PM
  2. update sql code check
    By Jen0dorf in forum Access
    Replies: 3
    Last Post: 01-28-2016, 04:40 AM
  3. Replies: 2
    Last Post: 07-27-2015, 05:20 PM
  4. Replies: 5
    Last Post: 06-26-2014, 12:52 PM
  5. Replies: 4
    Last Post: 03-10-2014, 12:18 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