Results 1 to 5 of 5
  1. #1
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727

    Login Form and VBA scripting

    Does anyone know how to create a login form that will only keep a record of the person that logs in if they enter data in a form.

    So the steps are like this:

    1. Clerk logs in with name and password.
    2. Directed to data entry form.
    3. Clerk types in data.
    4. Clerk prints form for customer. (right after clerk prints form, it saves the record in database table)

    The data saved into the database table is what the clerk filled out in the form and also his/her name from when they logged in, date, and time of when they printed the form so we know who logged in to create the record and print it for the customer.
    The date and time is not mandatory but would be a nice feature to have.



    I know nothing of VBA scripting and would need something that I can just edit to fit my scenario if possible.

    Thank you very much in advance.

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    you need an trigger point for your code to run. or a query to run. so try using a form's "dirty" property. that's triggered only once when the first bound field is manipulated by the user. if you want a trigger point such that an actual form is printed or submitted (or some other end-transaction point), write your code behind the print button or the button you have designated for that specific transaction.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Here is something you could do. Create 2 fields in your table. One named LastModified and one named loggedin Also usingthe code below you can capture what you want. Hope this helps.

    Me.Caption = Environ("UserName") & " is logged on " ' This is a caption but you can use it without the caption.
    Default Value
    LastModified Date/Time Now()
    loggedin Text ="CurrentUser()"

  4. #4
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26
    Hi, do you have any code you can post or can you post a copy of your Db?

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Private Sub Command1_Click()
    On Error GoTo Err_Command1_Click
    Dim I As Integer
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Categories and Products"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    DoCmd.OpenForm stDocName, acNormal, "", "", , acNormal


    Forms![Categories and Products]![Customer ID] = Forms!TimeCards!NameC
    Forms![Categories and Products]!Address = Forms!TimeCards!Address
    Forms![Categories and Products]!ExpCity = Forms!TimeCards!City
    Forms![Categories and Products]!Text371 = Forms!TimeCards!Text162
    Forms!TimeCards![Repair Order Number] = Forms![Categories and Products]!Text422
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    If Me.Dirty Then Me.Dirty = False

    DoCmd.Close acForm, "CatAndProdAddNew"

    'ExpCity: [City] & ", " & [Region] & " " & [Postal Code] as seen in query.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Login Form
    By data808 in forum Forms
    Replies: 1
    Last Post: 08-23-2012, 04:48 PM
  2. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  3. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 AM
  4. Login to a form?
    By tandkb in forum Forms
    Replies: 0
    Last Post: 04-25-2011, 06:05 PM
  5. Connect via ODBC and vb scripting or php
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-28-2010, 08:41 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