Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17

    Update Query (Select all Records or Select Only Filtered Records)

    Hi,
    Plz note, My VBA is disabled in my pc, I can use Expression builder, Macros, Queries, tables, Forms and Reports only
    I have a Form and a button,
    this button has 2 jobs that:
    1. if you click it, it will select all the checkboxes control in my form Or
    2. if you filter the form, and click it, "it will only select the filtered records"

    One of my friends helps me to do it and it is works 100% with only filtered textboxes, but once I filter the table and click the button to select all the filtered records Combo Boxes I got error message
    most of my project are comboboxes

    I put Sample in my Onedrive plz help me indeed!

    Download my Sample
    https://1drv.ms/f/s!ApJmppw4FPiTgfR-GXLRWp2Cpl9BNw



    Upload your Solution
    https://1drv.ms/f/s!ApJmppw4FPiTgfUAQ7dNWrE0GyH8cQ

    Click image for larger version. 

Name:	e5c4a5e4-36ff-400f-b084-88f2c58ec0b4.png 
Views:	37 
Size:	23.4 KB 
ID:	46432

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    not many people who respond here use macros (I don't). All I can tell you is the error is telling you it can't find that parameter and I suspect you need to refer to it in some other way. It may be you are using lookups in your table design which also causes complications

    Many also won't download from unknown sources, much better to attach your file to the thread (you need to go to advanced). Ensure you compact and zip the file before uploading

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Well, I took a chance and tried download. My system blocked the accdb. Attach your file to post. 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.

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    I was able to download it:

    sarah.zip

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Didn't provide the error message you get. I get a popup prompt for [Lookup_UserNameF].[UserName]. The form Filter property has =([Lookup_UserNameF].[UserName]="Sarah"). This expression is created when using right click menu or ribbon filter because of combobox using alias (happens even if there is no lookup built in table).

    TicketT has lookup field where the actual value stored is ID, not UserName, but this alone is not cause of issue - using the form Filter built as described above is the issue. The field in TicketT is UserNameF, not UserName. Cannot use the form Filter as is to run conditional UPDATE on TicketT. You need: UserNameF = 1. Change SQL in macro to not reference form Filter but to pull value from combobox:

    ="UPDATE TicketT SET TicketT.Download = True WHERE UserNameF = " & Forms![TicketF]![UserNameF]

    If you don't want to see the UPDATE warnings, then use SetWarnings method to turn them off and on.

    Then in form Close event, macro that sets Filter to "" so next time form is opened the Filter property is blank, otherwise, form will close with the last filter expression saved in Filter.
    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. #6
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17
    Thanks for Help!

  7. #7
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17
    Thanks, I will try it and let you know soon!

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    See if this overhaul meets expectations:

    sarah-davegri-v01.zip

    It was a real effort to keep all code as macros.

  9. #9
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17
    Quote Originally Posted by davegri View Post
    See if this overhaul meets expectations:

    sarah-davegri-v01.zip

    It was a real effort to keep all code as macros.

    Hi, you did great job!, but what I mean, If I make single filter or multi filter from the table and then I Click on the button that will select all the filtered records, on [Download] and then I will connected this [Download] with a report to show only the record that I have been filtered and selected by [Download] check boxes

  10. #10
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Hi, you did great job!, but what I mean, If I make single filter or multi filter from the table and then I Click on the button that will select all the filtered records, on [Download] and then I will connected this [Download] with a report to show only the record that I have been filtered and selected by [Download] check boxes
    You want a report like this?

    Click image for larger version. 

Name:	SarahUser.png 
Views:	24 
Size:	17.8 KB 
ID:	46452

    ================================================== ============

    Or like this?

    Click image for larger version. 

Name:	sarahMore.png 
Views:	23 
Size:	51.7 KB 
ID:	46453

  11. #11
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17
    Yes! I want picture number 2, If I make single filter or multi filter to the table then I click on the button and it will select [download] for the only filtered record and then I can print report for them for the only filtered and selected by dowload control check boxes
    Wonderful! Thanks!
    For example, I make filter from the table for today Ticket and then I filter by Sarah1 when I get result I click on the Button and then it will select all the Filtered result only, and then print report as PDF. So 1. I make Filter from Single or Multi, 2. I click on button to select all the result that got from the Filtered, 3. Print the Selected result by download check box
    ================================================== ============

    Or like this?

    Click image for larger version. 

Name:	sarahMore.png 
Views:	23 
Size:	51.7 KB 
ID:	46453[/QUOTE]

  12. #12
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Tried my best to keep functionality in macros and cannot spend more hours on getting such simple functionality to work.
    Here's the working DB with VBA, and it only took 15 minutes.

    sarah-davegri-v02.zip

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Suggestion in post 5 did not resolve issue?
    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.

  14. #14
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Quote Originally Posted by June7 View Post
    Suggestion in post 5 did not resolve issue?
    Don't know it that was directed to me or OP, but June7, did YOU try to get that thing to work with macros using your suggestions? If so, please post here so that I can learn something. I found other issues that cropped up because of macros.

  15. #15
    Sarah.M is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    17
    Quote Originally Posted by davegri View Post
    Tried my best to keep functionality in macros and cannot spend more hours on getting such simple functionality to work.
    Here's the working DB with VBA, and it only took 15 minutes.

    sarah-davegri-v02.zip

    Thank you very much!!!

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-26-2021, 08:02 AM
  2. Replies: 3
    Last Post: 01-22-2021, 10:21 AM
  3. using select query to add records
    By ntambomvu in forum Access
    Replies: 8
    Last Post: 03-11-2019, 11:25 PM
  4. Replies: 2
    Last Post: 05-28-2013, 04:00 PM
  5. Replies: 3
    Last Post: 01-24-2013, 02:38 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