Results 1 to 10 of 10
  1. #1
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66

    Invoice Numbering

    I have a report that has "Text137" that has my ReportNum (="ITS" & "-" & "ECS" & "-" & [AgencyID] & "-" & "000"). I would like to have the ReportNum increase by 1. [AgencyID] is a text box. I also have a Button that stores parts of the report into a table called "Report". Below is the code I'm currently using to load the Report fields into the Table "Report". SO the fix I need would increase the "ReportNum/Text137" by 1 and also change the code below to allow it to be imported into the Table "Report". Thank you for any help.

    Private Sub Command192_Click()
    CurrentDb.Execute "INSERT INTO Report ( ReportNum, AgencyID, AgencyName, ServiceGroup, StartDate, EndDate, ServiceName ,Total) " & _
    " VALUES ('" & [Text137] & "'," & [AgencyID] & ",'" & [AgencyName] & "','" & _
    [ServiceGroup] & "',#" & [Text106] & "#,#" & [Text0] & "#,' " & [Label197].[Caption] & " ', ' " & [Text188] & " ')"


    End Sub

  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,648
    Generating custom unique identifier is common topic. Here is one for start https://www.accessforums.net/databas...try-21975.html
    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
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    I see lots of Threads of using a table to create the identifier. I have a report I would like to create the identifier and then transfer it to a table.

  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,648
    A table is always involved if ID is incremented. Code would build new ID based on the latest ID in table. First code has to pull up the last ID and then increment. A review of links should have led you to example code in http://forums.aspfree.com/microsoft-...ta-403208.html

    What do you mean by 'load the Report fields into the Table "Report"'? Why are you not just using a query as the report data source?
    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
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    I have a query that pulls from multiple tables and creates the report. I then have a table that is created from important information from the report. This report does include the ReportNum along with some other info.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    You are assigning ID number for each report? Don't think ever seen this. What if you want to reprint the report? Don't want to generate a new ID just for reprint. So the real trick is determining when and where to run code that generates ID.
    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.

  7. #7
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    The Reports are being saved as pdf. The table is so that the pdf can be searched more easily.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Report to PDF is one way to go. In my database, a report can be reprinted just be re-rendering the report in Access with the same filter criteria.

    Regardless, when to generate the unique ID and commit record is still issue. Perhaps in the code behind form that opens report or in the report Close event.
    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.

  9. #9
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    I'm trying to figure out how to use the link you sent me. I'm not even sure if I should be using both parts. I have a Form called "Filter" that has a button that creates the report/(invoice). The invoice number(ReportNum) appears as ITS-ESC-[AgencyID]-0001. The table that the ReportNum is loaded into and should be reference is called "Report". In the invoice the ReportNum is located in [text137]. Please help

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    First, I would not build invoice numbers that use other data in its structure. AgencyID is agency being billed?

    The GetNewLabNumber() function is the code that actually generates the new ID. The other procedure is example of calling the function. Adapt and use as appropriate for your situation.
    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.

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

Similar Threads

  1. Confusing Invoice Sequential Numbering with Year and "BW"
    By breakingme10 in forum Programming
    Replies: 8
    Last Post: 07-22-2014, 09:11 AM
  2. Replies: 30
    Last Post: 07-03-2014, 01:22 PM
  3. Invoice Numbering
    By Gatorjunkie in forum Access
    Replies: 1
    Last Post: 03-20-2014, 11:57 PM
  4. Replies: 3
    Last Post: 11-19-2012, 05:05 PM
  5. Replies: 1
    Last Post: 10-10-2012, 01:05 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