Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 43
  1. #16
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    I think I will have to go back to the drawing board on this one as I don't have a clue. I have done quite a lot of coding for my database and this problem seems really simple to solve, but clearly not.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    It would filter the report same as the listbox. Report RecordSource could be:

    SELECT qryRoomInformation.*
    FROM qryRoomInformation
    WHERE ((([qryRoomInformation]![CampusNames] & [qryRoomInformation]![BuildingName] & [qryRoomInformation]![RoomNumber] & [qryRoomInformation]![RoomActivity] & [qryRoomInformation]![RoomType] & [qryRoomInformation]![WorkType]) Like "*" & [forms]![frmBuildingSearch]![SearchFor].[Text] & "*"))
    ORDER BY qryRoomInformation.RoomNumber;
    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. #18
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    I will give it a go after i have eaten and will get back to you. Thanks again

  4. #19
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Still no joy with that. i just dont get why the filter does not exceed 495 records. if i dont filter the list i can print a full report of over 1000 records.

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    Provide your db for analysis, follow instructions at bottom of my post.
    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.

  6. #21
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    I will do that tomorrow. May take a while as the are lots of forms, tables that I no longer need in there. Thanks again for replying.

  7. #22
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by hinchi1 View Post
    I will do that tomorrow. May take a while as the are lots of forms, tables that I no longer need in there. Thanks again for replying.
    I have attached part of the database which relates to the building reports. there is nothing sensitive here, only room numbers. locations, etc. The full database contains 4 other report forms which are identical to this one but link to different data, so if you can solve this issue then you would enable me to use the solution on the other forms. The default output is to PDF. Word output works but the Excel output needs more work on it as there are two unknown numbers fields at the top of the spreadsheet( i believe they are the autodate and autotime controls in the report). I need to create seperate reports for this this and remove those controls. Also, all populated fields are greyed out (unsure why). As you will see if you select no more than 495 records the report will output, anything more than that then nothing happens. I am guessing my code behind the "Part Report" button needs a bit of work. The reports are nothing fancy but do the job. At some point i may addd graphs, charts, etc, but for now they are functional. Thanks again for spending time on this it is very much appreciated.Database Export.zip

  8. #23
    Join Date
    Apr 2017
    Posts
    1,775
    In OnChange event of SearchFor_multi textbox, you set the button cmdPreviewReport disabled whenever anything is entered into SearchFor_multi texbox - and it isn't enabled unless you clear the textbox.

    PS. For button cmdViewSelection exact opposite applies.

  9. #24
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by ArviLaanemets View Post
    In OnChange event of SearchFor_multi textbox, you set the button cmdPreviewReport disabled whenever anything is entered into SearchFor_multi texbox - and it isn't enabled unless you clear the textbox.

    PS. For button cmdViewSelection exact opposite applies.
    The idea is that when an item or items are selected from the listbox or text is entered into the "SearchFor_multi textbox" the user wants to just print out the selected items (Part Report), that is why the buttons are diabled in that way. The naming of the buttons may need changing to avoid confusion but i do have them active or disabled in the correct format, hopefully and thanks for your feedback.

  10. #25
    Join Date
    Apr 2017
    Posts
    1,775
    OK. In OnClick event for CmdViewSelection you had defined OnError part of code, but you didn't use it. When I activated error trapping, then you get an error at command
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN(" & strWhere & ")"
    When the command returned an error, the Error put into Watch window returned a message "The filter operation was canceled. The filter would be too long." Btw. the string strWhere was 3126 characters long.

  11. #26
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by ArviLaanemets View Post
    OK. In OnClick event for CmdViewSelection you had defined OnError part of code, but you didn't use it. When I activated error trapping, then you get an error at command
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN(" & strWhere & ")"
    When the command returned an error, the Error put into Watch window returned a message "The filter operation was canceled. The filter would be too long." Btw. the string strWhere was 3126 characters long.
    I agree with you and this is the problem i am having as i don't know how to resolve the "string is too long issue". Any feedback is much appreciated. Examples of how to overcome the error would help, if you have any. Like i said in an earlier post i have 4 other forms using the same filter but at this time the other forms do not exceed 495 records, but at some point in the future they will. Granted my code my be a little rough round the edges and not having using Access for 15 years or more until 5 months ago, in the main i am happy with my efforts. Please keep your ideas coming.

  12. #27
    Join Date
    Apr 2017
    Posts
    1,775
    In your attached table, I created a table tblDummy with a single field RoomID (Long Integer, PK), and filled it with all RoomID's from qryRoomInformation;
    In OnClick event of cmdViewSelection, I changed the command line
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN(" & strWhere & ")"
    to
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN (SELECT RoomID FROM tblDummy)"
    Now I selected something in text box SearchFor_Multi (simply to get the button activated, anyway 1096 rows report was generated), clicked the button, and got the report.

    You have to figure out, how to fill the tblDummy (or whatever you name it) from your form. And of-course to clear previous RoomID's from there too before inserting a new selection.

    The difference is 40-character condition string vs. several thousand character condition string.

  13. #28
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by ArviLaanemets View Post
    In your attached table, I created a table tblDummy with a single field RoomID (Long Integer, PK), and filled it with all RoomID's from qryRoomInformation;
    In OnClick event of cmdViewSelection, I changed the command line
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN(" & strWhere & ")"
    to
    Code:
    DoCmd.OpenReport "rptPartBuildings", acViewReport, , "RoomID IN (SELECT RoomID FROM tblDummy)"
    Now I selected something in text box SearchFor_Multi (simply to get the button activated, anyway 1096 rows report was generated), clicked the button, and got the report.

    You have to figure out, how to fill the tblDummy (or whatever you name it) from your form. And of-course to clear previous RoomID's from there too before inserting a new selection.
    again i agree, but at this time it is something i will have to research as this is new to me. i firstly dont understand how to create a dummy table or even if say i have selected more than 495 records from the listbox and to insert them into the dummy table. Should say if i select more records than 495, copy these records to a dummy table output to a report and then delete the tempoary table. I have seen a few posts on creating temp table but this is a little too advanced for me at this stage, but will investigate further.

  14. #29
    Join Date
    Apr 2017
    Posts
    1,775
    A dummy table is an ordinary table which main task (99.999% of it's live time) is to be empty . When you need, you put some data into it, use those data, and after that you delete data. No need to delete the table - it will sit there patiently, and wait when it is needed again.

    And no need to design a different code depending on number of rows (which can vary depending on length of RoomID's you select). Have you selected 1 RoomID, or million, the schema with dummy table will work always.

    As to "How to fill the dummy table" - obviously you have to execute some INSERT query string in OnClick event of cmdSelectAll. The query string may be something like
    Code:
    "INSERT RoomID INTO tblDummy FROM qryRoomInformation WHERE Left(CampusNames, Len(" & SearchFor_Multi & ")) = '" & SearchFor_Multi & "'"
    And (before this and) after running the report, you have to execute the query string
    Code:
    "DELETE FROM tblDummy"
    Remark. Somehow after making an entry, I often can't edit it immediately - "save" simply don't work,

  15. #30
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    so could i do an update and delete query to the same temp table, before the delete obviously output data to the report? To be honest this is getting a little confusing. i have it in my head as to what i need to do, but unsure how to execute the task a this time.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. filtered subform unshown records when choose another brand
    By georgesobhyy@gmail.com in forum Forms
    Replies: 6
    Last Post: 09-19-2016, 07:32 AM
  2. Dcount records from a filtered form
    By charly.csh in forum Access
    Replies: 6
    Last Post: 11-20-2014, 01:14 PM
  3. How to get count of filtered records
    By DBDave in forum Queries
    Replies: 2
    Last Post: 11-03-2014, 02:07 PM
  4. Exporting Pivot Table to Excell - only want filtered records
    By Jennifer227 in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2011, 03:10 PM
  5. Open form to filtered records
    By ducecoop in forum Access
    Replies: 3
    Last Post: 10-22-2010, 10:53 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