Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20

    Daily Task database

    Im fairly new to access/VB and have been working on a simple task database that will allow me to enter daily entrees with a description field, date and time, and user id of the user entering the info - (user stamp)



    I've downloaded "sullitec"'s sample posted on 09/11/12 - which was very useful. I've merged components from both "sullitecs" and mine. All plays well together with the exception of user log. It can log who is logged into the pc itself (ad user), but not the user who actually logged into the log in screen.

    Any advice or guidance would be appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not familiar with that sample or how you may have modified it. Generally speaking, if you use a custom login for your application, save the logged in user somehow. I just hide the login form after successful login, enabling me to refer to the user textbox on that form from anywhere.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    My database handles entrees based on a date and description. I need to implement username with the entry. The problem I am having is associating the user who logged into the database with a new entry made (tblSecurity's UserID). That being said, i need the new entry to insert the UserID field (automatically) of the user who is logged in. Ive been able to make the UserID entry auto populate with the username of the user logged into the PC.
    My database has a tblSecurity, which has users and an tblEvents wich contains entry's (date, description and user who made enrty)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You've basically restated the question. Did you try what I suggested?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    Yes, Im able to hide the login screen, but that's not my issue. The issue is when a user creates a new entry in the database, that entry needs to automatically add a field with the username to keep track of who created the entry or modified it.
    To recap, once you start the database, it prompts for a login. Once logged in, it opens up my form which is associated with the events table- displaying all entrees. On that form, you select create new entry and another table( event details) opens up and that is where the users name needs to auto populate. Hope that makes sense.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    How did you do it with the user logged into the PC? You should be able to adapt that to get the value from the hidden form instead.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    A module that was included in the login template I used from sullitec's template

  8. #8
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    Im still struggling with this database. Ive checked all relationships, tables, forms and could not pin point the issue. Any other suggestions? When creating a new entry into a from(EventTable) it opens another form (EventTableDetails) to enter the specifics. I would like a TextBox field to auto populate the current user logged into the database.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    Here's the database, thanks.
    Once started, login as newuser, pw newuser. The form starts, choose - "Open Task Book". There you will see all events created (Event Table). Select "New Event". Within that form, im trying to auto populate the Name field to correspond with the user who is currently logged in.

    TaskBook.zip

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Give it a default value of:

    [Forms]![frmUserLogon].[txtUser]

    and make sure to hide rather than close that form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    Were you able to get that to work on the file i sent? It doesn't seem to be working, getting #Name? I see how the value should grab the info, but not sure how it retrieves the txtUser.

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Yes, but I had to stop the login form from closing, as that's what it was doing, and why you're seeing that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    augcorv@gmail.com is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2014
    Posts
    20
    The login form is closed once you click OK. The OK, On Click - Event Procedure is Visual Basic. Im not great at VB and trying to change close to hide...the VB is as follows:

    Option Compare Database
    Option Explicit
    Private Sub cmdCancel_Click()
    On Error GoTo Err_cmdCancel_Click
    Dim intResponse As Integer

    Forms!frmUserLogon.Visible = False

    intResponse = MsgBox("Are you sure you want to cancel?", vbYesNo + vbExclamation, "Exiting System")

    Select Case intResponse
    Case vbYes
    DoCmd.Quit
    Case Else
    Forms!frmUserLogon.Visible = True
    End Select
    Exit_cmdCancel_Click:
    Exit Sub
    Err_cmdCancel_Click:
    MsgBox Err.Description
    Resume Exit_cmdCancel_Click

    End Sub
    Private Sub cmdOk_Click()
    On Error GoTo Err_cmdOk_Click
    '-----------------------------------------------------------------------------------------------------------------------------
    ' This code is used to validate users found in the tblSecurity table. If the wrong user name or password is
    ' provided access is denied.
    ' Created by: Liam Sullivan
    ' Date Created: 08 Jan 2012
    ' Date Modified: 08 Jan 2012
    '-----------------------------------------------------------------------------------------------------------------------------
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim rstV As Recordset
    Dim stDocName As String
    Dim stLinkCriteria As String

    Set db = currentdb()
    Set rst = db.OpenRecordset("tblSecurity", dbOpenDynaset)

    If Not IsNull(Me.txtUser) And Not IsNull(Me.txtPassword) Then
    rst.FindFirst "Password = '" & Me.txtPassword & "'" & " And UserID = '" & Me.txtUser & "'"

    If rst.NoMatch Then
    MsgBox "You entered an incorrect Username or Password." & Chr(13) & _
    "Please enter the correct Username and Password or " & Chr(13) & _
    "contact the Administrator for assistance.", vbOKOnly + vbCritical, "Logon Denied"
    ElseIf Me.txtPassword = "password" Then
    MsgBox "This is the first time you've logged in or your password has been reset." & Chr(13) & _
    "You must change your password before you can log in.", _
    vbOKOnly + vbExclamation, "Change Password"
    stDocName = "frmUserLogonNew"
    stLinkCriteria = "[UserID]=" & "'" & Me![txtUser] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Else
    stDocName = "frmStartup"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    End If
    Else
    MsgBox "You have left the Username and/or Password blank." & Chr(13) & _
    "Please enter the correct Username and Password or " & Chr(13) & _
    "contact the Adminstrator for assistance.", vbOKOnly + vbCritical, "Logon Denied"
    End If

    With User
    .AccessID = rst.Fields("AccessID")
    .ViewID = rst.Fields("ViewID")
    .Active = rst.Fields("Active")
    .Password = rst.Fields("Password")
    .SecurityID = rst.Fields("SecurityID")
    .UserID = rst.Fields("UserID")
    End With

    rst.Close

    Exit_cmdOk_Click:
    Exit Sub
    Err_cmdOk_Click:
    MsgBox Err.Description
    Resume Exit_cmdOk_Click
    End Sub
    Private Sub txtPassword_AfterUpdate()
    On Error Resume Next
    Call cmdOk_Click

    End Sub

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I guess I misunderstood this then?

    Quote Originally Posted by augcorv@gmail.com View Post
    Yes, Im able to hide the login screen, but that's not my issue.
    The code that closes the login form is in the timer event of frmStartup.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Making daily backup of database
    By JeroenMioch in forum Access
    Replies: 5
    Last Post: 10-30-2013, 04:50 PM
  2. Daily Log Database??
    By brittle in forum Access
    Replies: 2
    Last Post: 08-26-2013, 12:53 PM
  3. Replies: 1
    Last Post: 11-28-2012, 01:09 AM
  4. Help with Table Design for Employee Task Database
    By shelbsassy in forum Database Design
    Replies: 6
    Last Post: 04-08-2011, 05:14 PM
  5. Help starting up a daily entry database
    By sparx in forum Database Design
    Replies: 1
    Last Post: 01-12-2011, 10:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums