Results 1 to 6 of 6
  1. #1
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114

    CHeck box in form creates data in report

    Hello all, first post here.



    I am creating some reports for work as well as a new form. The form will be used for data input and on that form I have created a combo list with the following options.


    -Item due in Next 4 weeks - (will be put in Report A)
    -Item due During Next 4 weeks (will put in Report B)
    -Item is Awaiting Court Decision (will be put in Report C)

    I will then be creating separate reports depending on the item chosen. I am wondering how to get the report to only grab the data needed for that specific report. Found
    some code online but not really doing anything at all.

    Any help would be much appreciated.

    Pete

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,515
    make a table tReports for the user to pick. on the form a combo/list box will show the list to choose, and the report assicated. (the user need only see the Caption)
    tReports
    [caption] , [report]
    Next4 Weeks, rNext4WeekRpt
    DuringWeeks, rDuring4WeekRpt

    user picks the report, a button opens it

    Code:
    sub btnShowRpt_click()
       docmd.openreport cboRpt , acPreview
    end sub

  3. #3
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    First of all thanks for the reply.
    If i get what you mean...When the button is checked it instantly creates a report.


    What I am looking for however is I guess a query from the report a, report b report c that checks to see which entries have me marked with say Next 4 weeks or the corresponding box and then add it to the report.

    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	14.4 KB 
ID:	23532
    Attached Thumbnails Attached Thumbnails Capture.JPG  

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,515
    oh, then the form would build a 'where' clause depending on what you checked.
    since I don't know the tables, im guessing, either:

    make an invisible box to hold the 'where' clause when checked.
    Code:
    chkBox1_afterUpdate
       BuildWhereFromBoxes
    end sub
    
    sub  BuildWhereFromBoxes()
      if chkBox1.value then  txtWhere = "[field]=true
      if chkBox2.value then    
        if txtWhere <> "" then txtWhere = txtWhere & " and "
         txtWhere = txtWhere & "[field]=true
      endif
    end sub
    Then add the where to the sql

    OR

    the checkboxes are connected to fields in a table. This table is joined to the data to pull only that data.

  5. #5
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Think the easiest thing is to have the choice they make go into a table in my database, then get the report to query that field I guess.

    No clue though as I am very new to this. Not even sure how to get my current report to use what would be an IF statement I suppose to
    show the data.,

    Thanks
    Pete




    Quote Originally Posted by ranman256 View Post
    oh, then the form would build a 'where' clause depending on what you checked.
    since I don't know the tables, im guessing, either:

    make an invisible box to hold the 'where' clause when checked.
    Code:
    chkBox1_afterUpdate
       BuildWhereFromBoxes
    end sub
    
    sub  BuildWhereFromBoxes()
      if chkBox1.value then  txtWhere = "[field]=true
      if chkBox2.value then    
        if txtWhere <> "" then txtWhere = txtWhere & " and "
         txtWhere = txtWhere & "[field]=true
      endif
    end sub
    Then add the where to the sql

    OR

    the checkboxes are connected to fields in a table. This table is joined to the data to pull only that data.

  6. #6
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Anyone have an idea how to do this?

    Quote Originally Posted by pharrison74 View Post
    Think the easiest thing is to have the choice they make go into a table in my database, then get the report to query that field I guess.

    No clue though as I am very new to this. Not even sure how to get my current report to use what would be an IF statement I suppose to
    show the data.,

    Thanks
    Pete

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

Similar Threads

  1. Report Wizard creates Now() control
    By Lkrsfan2282 in forum Access
    Replies: 1
    Last Post: 03-24-2015, 10:53 AM
  2. Replies: 1
    Last Post: 02-04-2013, 12:06 PM
  3. Missing check box data in report
    By Reaper in forum Reports
    Replies: 2
    Last Post: 01-31-2012, 07:27 AM
  4. Form that creates records from a template
    By techaddiction7 in forum Forms
    Replies: 6
    Last Post: 07-20-2011, 05:11 AM
  5. Open form which creates new record
    By mjhopler in forum Forms
    Replies: 7
    Last Post: 02-09-2010, 01:37 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