Solved

Select all using a checkbox

Posted on 2011-02-24
13
360 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
  • 8
  • 5
13 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
ID: 34971331
what is the recordsource of the subform [CertSubF] ?
0
 

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 119

Expert Comment

by:Rey Obrero
ID: 34971477
what is certQ? table or query? if query, post the sql view of the query.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero earned 250 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now