Results 1 to 7 of 7
  1. #1
    dustonabt12 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    3

    Generate Fixed Number of Entries

    I need to create a report to electronically fill a form that I use at work. I'm having a heck of a time trying to figure out the best way to do it. It also doesn't help that I'm new at access. The form looks like this:
    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	105.7 KB 
ID:	12984

    My report right now looks like this:
    Click image for larger version. 

Name:	Capture 2.JPG 
Views:	15 
Size:	84.6 KB 
ID:	12985

    The idea was to have my query generate however many records I currently have for the details section (usually 2-5) and then somehow generate the remaining records as blanks to fill in the form. I needed exactly 14 total records to make the form whole when I print it out. Long story short, I am falling flat on my face. I can not figure out how to somehow force 14 results for each query.



    Issue number two is that I also cannot figure out why everything fits perfectly when my footer image is in a report footer but then when I put the same thing in a page footer there is always a small gap between the details and page footer sections. I need it in a page footer so that when my query returns 4 names (groups) and 5 weapons/name (5 records/group) I can force a new page and have one form per name (group).

    Does anyone have some suggestions or solutions?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742

    Solution for a Fixed-length Report

    I'm trying to make sure I understand your purpose.

    (1) Are the empty rows to be used to fill in for additional lines of data? If so, what is the significance of how many rows show on the screen? the default behavior for Access is to show one empty row, which is enough to allow the user to enter the next line.

    (2) Are the empty rows used to make sure a printed form looks exactly like your current form, Army Hand Receipt DA 2062? If so, then it's possible to make that happen. As a report, the result would not be updateable, though.

    ONE INELEGANT BUT EASY METHOD FOR REPORTS

    (3) One quick method, off the top of my head, to make the report version, is to add a subreport to the report footer.

    (3A) On the footer, make sure there is a non-visible field txtCount that calculates the number of lines that were used.

    (3B) Make the detail line of the subreport look exactly like the detail line of the real report, but make all the text boxes unbound.

    (3C) Then, you just have to make the record source for the subreport ANY QUERY that gives you the exact number of records that you need. Since the subreport has no fields bound to the fields in your query, it will print a blank line for each.

    For this example, I created a 12-record table called tblDummylines. Each record has one field, and the records contain the numbers 1 thru 12.
    Code:
    tblDummyLines
       LineNo   number
    The record Source for the subreport is as follows:
    Code:
    SELECT 1 FROM tblDummyLines WHERE [tblDummyLines].[LineNo] > [txtCount];
    If the txtCount textbox has calculated that there were 5 lines, then blank lines will be created in the subreport for the seven records 6 thru 12 in tblDummylines.

    NOTES FOR REFERENCE

    (4) Since the subreport doesn't have anything bound to the query return values, I'm returning the constant "1".

    (5) I tried using the TOP(N) keyword in the record source of the subreport, and Access complained severely, so the tblDummyLines workaround was the simplest method.

    (6) If you had several different reports that wanted to use this method, with different total numbers of lines, then it might be preferable to have the footer calculate the desired number into [txtLinesNeeded] rather than the used number into [txtCount], and reverse the sign of the WHERE clause to <= [txtLinesNeeded].

    That way your tblDummyLines could have any arbitrary number (like 99) of records in it and be a solution used for more than one type of report.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I managed to get the code in Tek-Tips thread to work. An issue is if the report is opened first in PrintPreview then sent to printer, the code for the blank lines doesn't work properly. Have to send direct to printer.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    dustonabt12 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    3
    Thank you for the replies. A little beyond my understanding but I'll have my buddy look at it who is more experienced. I'm sure we can come up with a solution using those suggestions.

  6. #6
    dustonabt12 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    3
    Thank you very much Dal for giving good directions. It took a day or two of playing around but I finally got it working. It was exactly what I needed to make this form look correct.

  7. #7
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    You're welcome. It's amazing what you can do with a hammer, pliers and tinsnips if you just keep at it.

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

Similar Threads

  1. Replies: 7
    Last Post: 10-09-2012, 02:22 PM
  2. Generate auto number like 100011,100012...
    By lizzywu in forum Access
    Replies: 6
    Last Post: 11-12-2011, 01:43 PM
  3. Auto generate reference number
    By JonB1 in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2011, 06:38 AM
  4. Convert number to fixed length text field
    By tpcervelo in forum Queries
    Replies: 1
    Last Post: 08-02-2010, 07:26 PM
  5. creation of reports with fixed number of rows
    By georgia in forum Reports
    Replies: 1
    Last Post: 02-17-2010, 10:40 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