Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Select all using a checkbox

Posted on 2011-02-24
13
Medium Priority
?
381 Views
Last Modified: 2012-05-11
I created 2 buttons a form to select and deselct all records on a subform, based on a checkbox.  When I select all records, the subform records are selected.  If I then deselect records, the code dosen't work, unless I exit the form and reopen.. Any suggestions ???
Private Sub SelectAllButton_Click()

    Dim db As Database
    Dim rs As DAO.Recordset
    
    Set db = CurrentDb
    Set rs = Forms![ContactMainF]![CertSubF].Form.RecordsetClone
    
    Do While Not rs.EOF
    rs.Edit
    rs!Print = True
    rs.Update
    rs.MoveNext
    Loop
    
    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing
    
    
 Forms![ContactMainF]![CertSubF].Form.Requery
 

End Sub

Open in new window

0
Comment
Question by:ml-sd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
13 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34971165
change this

Set rs = Forms![ContactMainF]![CertSubF].Form.RecordsetClone


with

Set rs = Forms![ContactMainF]![CertSubF].Form.Recordset
0
 

Author Comment

by:ml-sd
ID: 34971315
I tried that your comment, but after I run the code,  the subrecords were deleted ...?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34971331
what is the recordsource of the subform [CertSubF] ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ml-sd
ID: 34971414
yes
0
 

Author Comment

by:ml-sd
ID: 34971436

sorry i hit send to fast...  recordsource is certQ
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34971477
what is certQ? table or query? if query, post the sql view of the query.
0
 

Author Comment

by:ml-sd
ID: 34971504
crtq is a querey.  sql view attached

thanks
SELECT CertT.ID, CertT.MCDID, CertT.CertificateDate, CertT.CertificateComments, CertT.CertName, CertT.CertCompany, CertT.CertAddress1, CertT.CertAddress2, CertT.CertCity, CertT.CertState, CertT.CertZip, CertT.Print
FROM CertT
WHERE (((CertT.MCDID)=[Forms]![ContactMainF]![MCDID]));

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34971612
can you upload a copy of your db..

what is your intention on selecting all the records?
0
 

Author Comment

by:ml-sd
ID: 34971823
After the selection i am printing records...    i need to change the data to dummy data before sending,..
0
 

Author Comment

by:ml-sd
ID: 34972577
Heres the saple data  Thanks
Cert.mdb
0
 

Author Comment

by:ml-sd
ID: 34975587
I guess the question was harder than i thought :)
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 34976108
test this,

see the revised codes in the click event of the select and deselect buttons


Cert.mdb
0
 

Author Closing Comment

by:ml-sd
ID: 34976136
Awesome...   Thanks you so much.
I never would have figured that out.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question