Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I write a line to a report 1

Status
Not open for further replies.

bevsz

Programmer
Apr 23, 2005
9
US
I am creating a import for a file in Microsoft Access. I need to create an exception report and write any record that will create a duplicate record to my exception report. How do I write 1 line at a time to the exception report and then print it out at the end of my import function? I know where to place the code in my import just not how to write the line to the report in this way. Help please!
 
As far as I recall, if you have a unique index, Access will gerenate an Import_Errors table.
 
I guess more information is appropriate here. My form is reading a file that is XML and creating values for a table within Access from the XML file. I found that I have values in the XML that will create duplicate entries in the table as my form (with code behind it) processes the XML records. I just want to have my code in the form add a record to a report each time this duplicate value record happens. When the processing is complete, I will make the report available to the user.

Thanks.
 
To create such a report, you will need to create a table and base the report on the table or else write to a file using say, the FileSytemObject Object:

Code:
    Const ForAppending = 8
    Dim strPath As String
    
    strPath = CurrentProject.Path
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    If fs.FileExists(strPath & "\Log.txt") = True Then
        Set a = fs.OpenTextFile(strPath & "\Log.txt", ForAppending)
    Else
        Set a = fs.CreateTextFile(strPath & "\Log.txt")
    End If
    a.WriteLine strData
    a.Close
    'FollowHyperlink strPath & "\Log.txt"
 
I am trying to write a report to a hard drive on my network. The following is the code being used:

strCriteria = "WPNo1 = '" & Me.WPNo1x & "' AND WPNo2 = '" & Me.WPNo2xx & "'" ' And Stage = " & Me.Stagex & " And Version = " & Me.Versionx"


stDocName = "Graphic Work Package Report"
DoCmd.OpenReport stDocName, acViewPreview, , wherecondition:=strCriteria


DoCmd.OutputTo acOutputReport, "Graphic Work Package Report", "Snapshot Format", "\\Arsoafs\ARSOA Public\ARSOA CM\Staging Area for DA Authenticated Deliverables\1-1520-272-23&P\Rev_2"

I am getting an error that does not make sense to me.
The error is "The report snapshot was not created because you don't have enough free disk space for temporary work files."

It is err.number 2024. I know this is not the case. Why is this happening?
 
Thanks again Remou, I actually did start another thread when I realized what I had done. Again thanks for pointing me to this tip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top