How to select records for printing (please...)

naxi

Registered User.
Local time
Today, 11:22
Joined
Mar 24, 2003
Messages
11
Hi,

I have a query which contains three tables together: projects, contact persons and organizations. I use that query for entering information for projects (some of the fields for contact person and organization are there but I don't change them).

When I want to filter data based on different criteria I make the same query and apply filter on it.

What I need is the way how to mark records which I want to print? How can I go through my records on the form and mark them one by one, and then only those that I marked use later (for printig labels, mail merge, raports etc.) . I also need to clear them all in the same time.

Also , after I filter my query and get result form I have to have the same feature to apply on that result form. I need and option to mark all of them , and If I want to unmark some I can go one by one and erase marks. On the form that can be just a check box....

Thank you

naxi
 
The simplest method is to add a Yes/No field to your table. Then you can click which ones you want to print and base the query for your report based on which ones are set to Yes.
 
That works fine if I select records one by one. How can I select all of them (or erase all marks) in the same time?
 
You could use a multi-select list box.

I use this method to print a report.

I also include a command button to setect/deselect all in the list box.

Bit too complexed to post here but I can mail the db to you if you're interested (A2k or A97)
 
Rats! You again! :mad:

Just kidding.

I didn't suggest that strictly because of the complexity of the coding.

You can use my idea with an update query to change them all at the same time.
 
Ok,

First I forgot to tell you that I'm pretty new in database at all and I'm using Access 2000.

Is there any way to solve this without too complex coding coding ....

My problem is like this..
I have tree tables: organization->contact person->project

I have a form based on a query (this query has all my tree tables together , becuse I need all information), and on that query I apply filter based on many criteria. On that way I got projects and all other information connected with those projects.

When I get result form with filtered data I need to have an option to select all of them for printing or some of them.

If you have VBA code in mind (or SQL) I would need explanation what is what in that code

This is my first project and I learn as I go......

Thanks
 
Maybe you're trying to do too much too soon.

Keep it simple.

Use forms and subforms to split your data rather than base your form on all 3 tables.

You may find a better way.

Ease off on the vba and SQL for now.

You should be able to print a report from filterd data without using a lot of complexed code.

I have yet to create a db where the user just wants to print 'any old' records.

It's usually one record or a selection that are common in a group.
 
Last edited:
I hope I am not going over your head but this is the routine I used to select or
unselect all of my records "Print" Yes/No field in the table to either Yes or No
for printing the records. The table name is tblAuditors and the YesNo field is
named PrintMailingLabel.

Code:
Private Sub bSelectAllRecords_Click()
On Error GoTo Err_bSelectAllRecords_Click
    
    Beep
    
    Select Case MessagePrompt("Click the 'Yes' button to mark all records as ''Yes''." & vbCrLf & vbLf & "Click the 'No' button to mark all records as ''No''." & vbCrLf & vbLf & "Click the 'Cancel' button to abort this function.", vbQuestion + vbYesNoCancel, "Select All Records For Printing labels")
        Case vbYes: 'Select all records
            Beep
            DoCmd.SetWarnings False
            DoCmd.RunSQL ("UPDATE tblAuditors SET tblAuditors.PrintMailingLabel = Yes;")
            DoCmd.Requery
            DoCmd.SetWarnings True
        Case vbNo: 'Deselect all records
            Beep
            DoCmd.SetWarnings False
            DoCmd.RunSQL ("UPDATE tblAuditors SET tblAuditors.PrintMailingLabel = No;")
            DoCmd.Requery
            DoCmd.SetWarnings True
        Case vbCancel: 'Abort the function
            Beep
            MsgBox "The select all records function was aborted.", vbInformation
        Case Else: 'Default case to trap any errors.
            'Do nothing
    
    End Select
    
    Me.Recalc
    
Exit_bSelectAllRecords_Click:
    Exit Sub
    
Err_bSelectAllRecords_Click:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_bSelectAllRecords_Click
    
End Sub
HTH
 

Users who are viewing this thread

Back
Top Bottom