My application is an Access 2013 split db with 3 users.
For logging, I am sending Application Specific Errors (For example: a Function Error..) to an internal table named tbl_logs. For display and review purposes, I populate these logs to a form list box control. No dramas with this method.
However, for general Application Usage Logging, (For example: user exported a report..) I am writing logs to a text file which requires opening them manually.
I am wanting to fully automate this process preferably with the capacity to display the logs in a list box control on a userform.
Below is the best code I have found that will open a text file for display. When I tested it, I get an error on line 9 which I assume is to do with the variable fName.
Public Sub populate_TxtLog()
Dim F, fName
fName = CurrentProject.path & "\logs.txt"
'Const LogFileName As String = "C:\FOLDERNAME\TEXTFILE.LOG"
Dim FileNum As Integer, tLine As String
FileNum = FreeFile ' next file number
Open fName For Input Access Read Shared As #F ' open the file for reading
Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the text file
Loop ' until the last line is read
Close #FileNum ' close the file
MsgBox tLine, vbInformation, "Last log information:"
Has anyone got any ideas or previous examples of how one can go about this?