My application is maintaining the user login info and am saving it in application specific directory.

All the login info Sucessful/Failed is been saved in a text file as per the format given below.

FORMAT:
User_Name, Login_Time, Login_Date Logout_Time Logout_Date

administrator, 12:44:16 PM, 5/11/2006
12:44:19 PM, 5/11/2006

amit, 12:44:27 PM, 5/11/2006
12:44:34 PM, 5/11/2006

Ques 1: I need to save this data in a single line i.e;

User_Name, Login_Time, Login_Date, Logout_Time Logout_Date
amit, 12:43:49 PM, 5/11/2006, 12:44:19 PM, 5/11/2006

so that it can be easily opened in excel.

The code i am using is

VB Code:
  1. Dim strAllData As String
  2. Dim strDataBuffer As String
  3.    
  4.  'Added for capturing the logoff information
  5.  
  6. Open PWD & "/" & "log" & "/" & "loginfo.txt" For Input As #1
  7.     While Not EOF(1)
  8.         Line Input #1, strDataBuffer
  9.         strAllData = strAllData & strDataBuffer & vbCrLf
  10.     Wend
  11. Close #1
  12.  
  13. Open PWD & "/" & "log" & "/" & "loginfo.txt" For Output As #1
  14.    Print #1, strAllData & vbCrLf & txtUserName & ", " & Time & ", " & Date
  15.    
  16. Close #1

Ques 2: I want this login info file to be read only for application users

note: my application has multiple logoff (One on almost every form in the application) buttons so i am using this code at all these places.

Thanks,
Amit