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

    Create Table From Report


    I would like to create a table from a report to save critical data. The code I have below is what I have been able to get so far but it's not working.

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


    End Sub

    Please provide any guidance you can.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'd use a variable so you can examine the finished SQL:

    http://www.baldyweb.com/ImmediateWindow.htm

    Generally, date/time fields need # as a delimiter, not ', text fields need ' and numeric fields have no delimiter.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    You don't create tables from reports...you do it from a query.
    if that is what you mean, then take the existing query shown and change it to a MAKE table qry.

  4. #4
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    This is what I have..... I have Tables are filtered for information with a Form that runs a Query. The Query produces a report with the requirements the Form required. I would like to save the information that ends up on the Report into a Table. The main reason is to be able to view reports that were run in the past.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Personally I'd create a PDF of the report and save it somewhere (OutputTo).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    cfobare79 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Dec 2014
    Posts
    66
    I already have it exporting as a PDF. I would like to have further search criteria if the information needs to be reviewed.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Normally you'd just be able to run reports on an older date range and get the same results. If your data is changing, it might indicate a problem. In any case, as ranman mentioned you should be able to export the query. Of course, that would likely still be a restricted set of data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    TommyK is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    28
    You might try puting the Form's 'requirements' into the query instead. Simply running the query (not through the report) will display a table... of sorts. You could then export the query to an un-linked Excel spreadsheet for archival purposes.

    If the report performs column totals on rows of data, I don't think that can be done, but the raw data, will still be there.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-18-2014, 08:22 AM
  2. How create a table for a date range report
    By jegupta in forum Programming
    Replies: 12
    Last Post: 01-30-2014, 12:33 PM
  3. Replies: 7
    Last Post: 01-16-2014, 09:17 AM
  4. Replies: 2
    Last Post: 12-26-2013, 11:23 AM
  5. Replies: 3
    Last Post: 12-11-2012, 11:18 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