Results 1 to 8 of 8
  1. #1
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109

    Error 3145 (Filters)

    I was searching the web for examples of filtering continuousform and found database “StudentExplorerFilter” someone posted and it has the filters I was looking for. However I have hard time following the codes as it was written by advanced programmer. I was trying to use the same codes in my database “FilterTracking” but couldn’t make it work. I am getting Error 3145. I suspect that the problem lies in “strRecordSource” ,Private SubGetRecordSource() but with my beginner programming skills I don’t know how to fix it. Wonder if someone can look at the filtersand let me know what I am doing wrong here. Please see both databases attached.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Code constructs an SQL statement with WHERE keyword but nothing after WHERE because you have commented lines:

    'strWhere = "tbl_Tracking.P_Iso_Dwg Not Like """
    'strOrderBy = "tbl_Tracking.P_Iso_Dwg, tbl_Tracking.EHT_Iso_Dwg_No"

    Why? Need to provide something for the WHERE clause.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109
    June7, thanks for the replay, I have made the suggested changes but I am getting error 3075 on top of 3145. See dBase with change. Also would you be willing to explain what the Private Sub GetRecordSource() does, I can't figure out the logic behind it.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    I get error 3145 error twice when form opens. Not seeing 3075.

    WHERE clause still has nothing in it as shown by the print in Immediate Window. You need to learn debugging. Set a breakpoint in form code then close and reopen form. Step through code, watch it execute and view content of variables.

    strWhere is a global variable and its value is set in Load event but then GetRecordSource() uses global variables to set strWhere and overwrites what was set in Load event. These global variables do not have any values therefore the WHERE clause is empty and code errors.

    Modify line in GetRecordSource to concatenate strWhere to itself and error goes away:

    strWhere = strWhere & strPipArea & strPipPlant & strPipUnit & strPipModule & strPipEwp & strPipTracing & strPipIso _
    & strEhtIso & strEhtZone & strEhtEwp & strEhtStage & strEhtTracingChck & strEhtDwgType & strLdtFluidCode


    This is shown in the template database.

    Do a search on GetRecordSource and see where this Sub is called. It rebuilds WHERE clause with selections in search controls.

    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109
    Quote Originally Posted by June7 View Post
    I get error 3145 error twice when form opens. Not seeing 3075.

    WHERE clause still has nothing in it as shown by the print in Immediate Window. You need to learn debugging. Set a breakpoint in form code then close and reopen form. Step through code, watch it execute and view content of variables.

    strWhere is a global variable and its value is set in Load event but then GetRecordSource() uses global variables to set strWhere and overwrites what was set in Load event. These global variables do not have any values therefore the WHERE clause is empty and code errors.

    Modify line in GetRecordSource to concatenate strWhere to itself and error goes away:

    strWhere = strWhere & strPipArea & strPipPlant & strPipUnit & strPipModule & strPipEwp & strPipTracing & strPipIso _
    & strEhtIso & strEhtZone & strEhtEwp & strEhtStage & strEhtTracingChck & strEhtDwgType & strLdtFluidCode


    This is shown in the template database.

    Do a search on GetRecordSource and see where this Sub is called. It rebuilds WHERE clause with selections in search controls.

    [HTML]June7 thanks for your help, wonder if I can bug you one moretime. I finally made the filters work but have problem clearing individual filter, I found out that after I click on the button I can clear the combo value but the form doesn’t refresh neither does string in immediate window .
    [/HTML]
    Attached Files Attached Files

  6. #6
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109
    June7 thanks for your help, wonder if I can bug you one moretime. I finally made the filters work but have problem clearing individual filter, I found out that after I click on the button I can clear the combo value but the form doesn’t refresh neither does string in immediate window .

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    The string in immediate window is produced by a Debug.Print command. If procedure does not have this command then nothing will be sent to immediate window. Debug.Print is a debugging tool and is normally commented/removed when procedure works properly.

    cmdRemoveFilter procedure does not have a Debug.Print and since does not call GetRecordSource, there is nothing sent to immediate window.

    Follow template example in cmdClear code. Set variables and call GetRecordSource.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109
    Thanks June7, I didn't realized I was missing strWhere and StrOrderBy in each Private Sub cmdClear...._Click() evnt.

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

Similar Threads

  1. Filters
    By preveo in forum Forms
    Replies: 3
    Last Post: 03-30-2016, 11:54 AM
  2. Listbox filters
    By cbende2 in forum Programming
    Replies: 4
    Last Post: 05-24-2015, 02:02 PM
  3. 2 Filters on 1 datasheet
    By raffi in forum Modules
    Replies: 3
    Last Post: 11-30-2014, 04:09 AM
  4. Help with filters
    By daltman1967 in forum Forms
    Replies: 5
    Last Post: 07-14-2011, 02:12 PM
  5. About filters
    By registan in forum Forms
    Replies: 12
    Last Post: 04-09-2011, 08:01 AM

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