advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
Tip of the Day
Average Rating: 1/5 | Rate this item | 3 users have rated this item.
Expertise: Intermediate
Language: VB
March 9, 2004
Print an Error Report with NotePad
The following code prints out an error report to NotePad.

Private sub cmdPrintError_Click
  Dim curDB As Database
  Dim rs As Recordset
  Dim lSQL As String
  Dim retVal As Variant
    Open "C:\Database\txtValidate.txt" For Output As #1

    Print #1, "Company to Validate:" & " " & Me.txtCompany
    Print #1, ""
    Set curDB = CurrentDb
    lSQL = "SELECT qryValidate.[Company ID], qryValidate.[Employee
number]"lSQL = lSQL & " FROM qryValidate"
    lSQL = lSQL & " FROM qryValidate"
    lSQL = lSQL & " WHERE [Company ID] = " & Me.txtCompany & " AND ([Net
total cash] - [NetCheck]) >=" & 1 ")"
    Set rs = curDB.OpenRecordset(lSQL)

    If rs.RecordCount <> 0 Then
        rs.MoveLast
        rs.MoveFirst
        Print #1, "1)Record(s) not balance: " & rs.RecordCount & "/" &
DCount("[Company ID]", "qryValidate", "[Company ID] = " & Me.txtCompany &
"")
        Print #1, "CompanyID   EmployeeID"
    Else
        Print #1, "1)Record's not balance not found"
    End If
    Do While Not rs.EOF
        Print #1, rs.Fields("Company ID") & "        " &
rs.Fields("Employee number"),
        rs.MoveNext
    Loop
    Set rs = Nothing
    Print #1, ""
    Print #1, "Data inputer:"
    Print #1, "Date Time: " & Format(Date, "dd-mmm-yyyy") & "--" &
Format(Now, "hh:mm:ss AMPM")
    Set curDB = Nothing
    Close #1
    retVal = Shell("C:\Windows\write.exe C:\Database\txtValidate.txt", 1)
End sub
Minh Nguyen Tran Phan
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
Please rate this item (5=best)
 1  2  3  4  5
advertisement
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Help  |   Site Map  |   Network Map  |   About


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers