Results 1 to 8 of 8
  1. #1
    Costa is offline Novice
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Posts
    13

    Print selected records in a form created by a query

    Hello all ..



    I have a form that created by selected records via query .. I want to select some records and print them without printing the other records that are in the same form..

    Here is the steps I want to do :

    - A query checks for today's appointments
    - The results shown up in a form with checkbox near each record
    - I select some results (Records) to print them. ( I Want to use checkbox)
    - Then refresh the form to uncheck all the checked records.

    Is there any code to do this ?

    Waiting for your support

    Kind regards

  2. #2
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140
    Recommend creating an Access Report and SECOND Select Query.

    1. Create second Query (use the same fields as your Form's query) and type the following Criteria in your Checkbox field's column:

    Code:
    True
    2. Create Report for printing versus a Form. Use the second Query as the Record Source for the Report.

    3. Create a Command Button on your Form to Print Report

    4. Use VBA or Macro to perform the following actions from the Command Button's OnClick Event:

    a) Save Current Record

    b) Set Warnings to No

    c) Use the OpenReport command to Print Report

    d) Have a MsgBox ask "Do you want to uncheck ALL Tagged Records?"
    - If Yes, 1) Run SQL statement or Update Query to update Checkbox fields to False, 2) Use the Requery command to refresh screen
    - If No, do nothing

    The last step is entirely up to you, as to how/when you want to uncheck the Checkboxes.

    -RC
    Last edited by MAF4Fam6; 02-24-2010 at 09:46 AM. Reason: Changed OutputTo to Read: OpenReport

  3. #3
    Costa is offline Novice
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Posts
    13
    Hi

    thanks for the help ..

    Everything is working good .. but I need your help in unchecking the checkboxes

    Can you give me the code for this

    (( Have a MsgBox ask "Do you want to uncheck ALL Tagged Records?"
    - If Yes, 1) Run SQL statement or Update Query to update Checkbox fields to False, 2) Use the Requery command to refresh screen
    - If No, do nothing)

    thanks again

  4. #4
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140
    The attached Access database (inside zip file), contains one object (1 Macro).

    1. Right-Click and Export the Macro to YOUR database.
    2. Open your database, Right-Click the Macro and Open in Design View.
    3. Update the Action Arguments (Object Name) of the OutputTo Macro Action.
    4. Right Click the SQL Statement (in the Action Arguments of the RunSQL Macro Action) and Click Zoom:

    Code:
    UPDATE MyTableName SET MyTableName.MyCheckboxFieldName = False
    WHERE (((MyTableName.MyCheckboxFieldName)=True));
    a) Change MyTableName (3 instances) to match the name of your Table
    b) Change MyCheckboxFieldName (2 instances) to match the name of your Checkbox's field name

    5. Add the Macro to your Command Button's OnClick Event.

    -RC

  5. #5
    Costa is offline Novice
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Posts
    13
    Hello ..

    I got all the steps .. but I didn't understand this step :
    3. Update the Action Arguments (Object Name) of the OutputTo Macro Action.

    Can you explain it please ?

    Thanks

  6. #6
    Costa is offline Novice
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Posts
    13
    My table name is : Main Table
    Check box is : PrinReport
    Form Name is : DailyApp

    The checkbox values are : 0 or -1 (I'm not using True or False)

    Can you tell me what to edit in the macro ??

    Thanks again

  7. #7
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140
    Costa,
    My mistake...
    Please change the OutputTo Macro Action to an OpenReport Macro Action per the following screenshot:

    Attachment 711

    Thanks.

    -RC
    Last edited by MAF4Fam6; 02-24-2010 at 11:56 AM.

  8. #8
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140
    Just following up.
    Please let us know if your issue was resolved.
    Thank you.

    -RC

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-20-2009, 07:53 AM
  2. Replies: 1
    Last Post: 07-25-2009, 05:11 PM
  3. New Field Name on Newly created query
    By inan25 in forum Queries
    Replies: 3
    Last Post: 05-13-2009, 09:05 PM
  4. Replies: 2
    Last Post: 03-13-2009, 08:35 AM
  5. Loading the form with selected record
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 12-09-2005, 07:49 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