Log file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • THEAF
    New Member
    • Mar 2007
    • 52

    Log file

    hi,
    i'd like to create a log file..
    There is one form that has a list box where it shows all the login and logout times.

    Code for Form load
    [code=vb]
    Private Sub Form_Load()
    '
    Dim dbmyDB As Database
    Dim rsmyRS As Recordset

    Set dbmyDB = OpenDatabase("E :\skol\A2 Computing\Speed y Pizza database.mdb")
    Set rsmyRS = dbmyDB.OpenReco rdset("Log file", dbOpenDynaset)

    If Not rsmyRS.EOF Then rsmyRS.MoveFirs t

    Do While Not rsmyRS.EOF
    List1.AddItem rsmyRS!Log
    List1.ItemData( List1.NewIndex) = rsmyRS!Log
    rsmyRS.MoveNext
    Loop
    rsmyRS.AddNew
    List1.Text = rsmyRS!Log
    rsmyRS.Update
    End Sub

    Listbox code
    Private Sub List1_Click()
    rsmyRS.FindFirs t "Log=" & (List1.ItemData (List1.ListInde x))

    List1.Text = rsmyRS!Log
    End Sub
    [/code]
    the way the times are entered is when the user logs in i additem "login time the date and time " and when the user logs out the same thing but logout instead of login. when the user logs out the data should be saved. my problem is that it either saves it but field is empty in access or an array problem. so i ain't bothered with my coding. i was hoping if anyone can suggest a code that may work. please

    Thank YoU
    Last edited by debasisdas; Feb 27 '08, 09:07 AM. Reason: added code=vb tags
  • VBWheaties
    New Member
    • Feb 2008
    • 145

    #2
    Originally posted by THEAF
    i'd like to create a log file...
    You should make rsmyRS global if you are going to use it in several places. It looks like its dimmed at form load only.
    Last edited by Killer42; Feb 27 '08, 12:50 AM. Reason: Reduced quote block

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      If you are storing login and logout in the same table then when the user logs out you must update the database. But your code does not do anything like that. What you have is only form load.

      Comment

      • daniel aristidou
        Contributor
        • Aug 2007
        • 494

        #4
        Also its possible to keep a record of only the count of logins the last login and log out using the registry,,,,
        This would enable you to make sure nobody has deleted anything form the table...

        Comment

        Working...