Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
  1. #16
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi, Thanks and its looks a great work from you.



    I will review it in further details and get back to you.

    Thanks for your support.

  2. #17
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hello, I gone through this DB and its really a fantastic logical work. I also saw many other examples provided at ur Web and i can say its totally new world for new comers like me. I appreciate your work and sharing with world.

    I am interested to use your given Login DB, if you allow me for that.

    Thanks

  3. #18
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi, Thanks for your support and for the link. I looked into that and in fact, its very professional development. I would love to use this your login DB within my system, if you allowed me.

    After using yours Login DB, do we need to create the
    Public strCurrentUser as String
    , i dont think so.

    This is already a part of your given DB's login form
    Private Sub cmdLogin_Click()strCurrentUser=Me.txtUserName
    End Sub

  4. #19
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    I used this but having error of enteredby cant be zero length string.


    Private Sub Form_BeforeUpdate(Cancel As Integer)


    UpdatedBy = GetCurrentUser
    UpdatedOn = Now()
    End Sub

  5. #20
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You are welcome to use any of my free example databases or parts of them. All I ask is that you acknowledge the source of the code.

    Not sure i understand your error. Sounds like you're combining my code with your own and the two aren't communicating.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #21
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Well, You are right and really its a great support to juniors and we would stand to donate for such wonderful forums.

    No, now i will use only yours login DB. if i am using yours then what should be next step to get the enteredby and updateby info about the user.

    Kindly advise.

  7. #22
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Once users have logged in, you shouldn't get zero length strings or null values for strCurrentUser.

    You want to use that value for populating the EnteredBy & UpdatedBy fields in a table.
    So on your form(s), just set those fields equal to GetCurrentUser after changes have been made.
    e.g. using an after update event
    The before update event is used for validation - don't use it for populating those fields

    For a new record Me.EnteredBy=GetCurrentUser
    For an updated record Me.UpdatedBy=GetCurrentUser

    Or if you are using queries/ SQL statements to enter/update records, just include as a field in that code

    You mentioned donations. That is of course voluntary but would of course be very welcome
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  8. #23
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi,

    Thanks for the advises and explanation.

    I am not getting anywhere.

    Can you provide the solution according to your login DB which is being used by me now as well.

    I will appreciate your help.


    *This is off course, and we as junior should do so as we a learning a lot from our seniors.

  9. #24
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Can you upload a stripped down copy of your DB containing:
    a) all my login code
    b) the form you want to use for recording EnteredBy/UpdatedBy fields
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  10. #25
    cap.zadi is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi, Thanks

    I enclosed the DB and "FrmProcessA_Head" has the requirements of user name for both events of enteredby and updateby.


    One more question related to your login db solution.

    How user would logout after finished his task?

    I added a App exit button t a form to close the app after job is done but still it showed the user is logged in.

    kindly advise for this case too.
    Attached Files Attached Files

  11. #26
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    In Form frmProcessA_Head I changed the code in the Form_AfterUpdate & Form_Current events to use GetUserName instead of Environ("UserName")
    You will see 2 entries in that table - one for cridd (my network username) and one for delilah wh I logged in as

    If you look at frmSessions, there is a LogMeOut button. This includes the following 2 lines of code to close the session for this user and flag them as logged out.
    Code:
     
        Call CloseSession
        Call LogMeOff(lngLoginID)
    So all you need to do is add the same code to a button that exits the database or to a form close event that does the same thing
    For example

    Code:
    Private Sub cmdClose_Click
        Call CloseSession
        Call LogMeOff(lngLoginID)
        DoEvents 
        Application.Quit
    End Sub
    The line DoEvents is used to ensure the previous code has completed before proceeding. It may not be needed here but won't do any harm

    Other changes you need to make:
    1. When the Login button is clicked, you need to change the code to open one of your forms e.g. frmProcessA_Head (or a switchboard type form)
    2. Your database doesn't compile. I've made no attempt to fix any compilation errors but you need to do so.
    Attached Files Attached Files
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  12. #27
    cap.zadi is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi

    Thanks for the efforts and detailed explanation which makes things clear now.

    Yeah i modify accordingly and its showing the real current users now.

    Yah, i already created a DashBoard to show up after login form and put a button "CmdLogOut" on it and paste the code on click event as below:

    Private Sub CmdLogOut_Click
    Call CloseSession
    Call LogMeOff(lngLoginID)
    DoEvents
    Application.Quit
    End Sub
    and its logging out in immediately. What if, we want to prompt a message before logging out. Some thing like" Are you sure to log out the system", etc.

  13. #28
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    To add a message, then do something like this

    Code:
    Private Sub CmdLogOut_Click
       If MsgBox("This will log you out and close the application" & vbCrLf & _
            "Are you SURE you want to do this?, vbQuestion+vbYesNo+vbDefaultButton2,"Logout & Quit?")= vbNo Then Exit Sub
       Call CloseSession
       Call LogMeOff(lngLoginID)
       DoEvents 
       Application.Quit
    End Sub
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  14. #29
    cap.zadi is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi

    Thanks for the efforts and its working fantastic so far.

    Since you have the DB copy already and review of it.

    There is one pending thread related to that DB copy.

    I will appreciate if you can have a look around for any positive solution.

    https://www.accessforums.net/showthread.php?t=74097

  15. #30
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I did look at that thread briefly but as WIP meant nothing to me & others had replied I left it alone
    Sorry but I haven't got time to study it now

    However, in the last post in that thread you wrote
    At Process_C: At the start of the shift via Form "FrmProcessC_Head, The Operator should be able to select the product List available in Process_B (Off course Produced by Process_A) via form "FrmProcessC_Tail". Once he select the Product then only related DCars should be shown in the selection list of "DCars No" at form "FrmProcessC_Tail1".
    That suggests you may want to use cascading comboboxes.
    Have a look at this example and see if it helps: http://www.mendipdatasystems.co.uk/c...xes/4594455723
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-23-2016, 07:35 AM
  2. Replies: 3
    Last Post: 12-14-2011, 01:24 PM
  3. Replies: 6
    Last Post: 12-12-2011, 01:28 PM
  4. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  5. Replies: 3
    Last Post: 09-22-2011, 03:35 PM

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