Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2011
    Posts
    20

    Thumbs up Complex issue in MS access

    Hi All,
    Im doing a project in access which i have created tables, forms and reports i have applied user secuity in my project.some users have editable permissions and some doesnt have.
    In my form i have two fields which will capture system date & time as start time and end time.
    start time will capture the time when the user starts keyin and the end time will capture the time after the record has been inserted in the table.
    My problem is for non-editable permission users,the end time is not storing the time after inserting record since it will capture only after insertion and it goes to update state for whom doesnt have update permissions.
    Hence i need code to capture and store the end time after the users filling all fields and before insert in to table.


    Hope you guys got my problem. Plz provide me a solution.
    Last edited by ganeshvenkatram; 06-09-2011 at 04:23 AM. Reason: Spell check

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum.


    In my form i have two fields which will capture system date & time as start time and end time.
    start time will capture the time when the user starts keyin and the end time will capture the time after the record has been inserted in the table.
    Is the data entry form unbound?

    How are you inserting the record?

  3. #3
    Join Date
    Jun 2011
    Posts
    20

    Thumbs up Re Complex issue in MS access

    Hi Thanks for your reply

    Unfortunately I think u didnt get my exact problem.

    According to your project , u will update the endtime after inserting a new record.
    In my project some users doesnt have update permissions so that i cant able to update the end time.
    I have even tried using form's before insert event.

    What happened is, the form's before insert event was fired when the new record got the focus and it is not firing again before inserting the record.

    For example
    i have 5 fields in my form which include Name, age,city, start time and end time. I have wrtiten the following code in form'before update event

    <Code>
    Private Sub Form_BeforeInsert(Cancel As Integer)
    txtEndtime = Format(Now, "dd/MM/yy hh:mm ss")
    End Sub
    </code>
    The above event got fired when the new record got focus in first field. Suppose i have started code at "10/07/2011 10:10:10" and end time has that value. After filling all records and when moving to new record, the form's before insert event is not firing again hence the end time remains at
    "10/07/2011 10:10:10". This is the problem i'm facing.

    Please Suggest me.

  4. #4
    SteveH2508 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    Why not use the AfterInsert event?

  5. #5
    Join Date
    Jun 2011
    Posts
    20

    Thumbs up Re :Complex issue in MS access

    Hi Thanks for ur reply

    After insert means that it will go to update mode for which some user doesnt have that permissions. They have only insert permission

  6. #6
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Unfortunately I think u didnt get my exact problem.
    Which is why I asked questions.


    What happened is, the form's before insert event was fired when the new record got the focus and it is not firing again before inserting the record.
    The before insert event fires just before the new (blank) record is created in the table. It only fires when a new record is created, so it won't fire again.

    For example
    i have 5 fields in my form which include Name, age,city, start time and end time. I have wrtiten the following code in form'before update event

    <Code>
    Private Sub Form_BeforeInsert(Cancel As Integer)
    txtEndtime = Format(Now, "dd/MM/yy hh:mm ss")
    End Sub
    </code>
    The above event got fired when the new record got focus in first field. Suppose i have started code at "10/07/2011 10:10:10" and end time has that value. After filling all records and when moving to new record, the form's before insert event is not firing again hence the end time remains at
    "10/07/2011 10:10:10". This is the problem i'm facing.

    Please Suggest me.
    I would use the form before update, not the before insert.

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    txtEndtime = Now()
    End Sub
    Formatting the date/time only affects how data is displayed, not how it is stored in the table, so it is not needed.

  7. #7
    Join Date
    Jun 2011
    Posts
    20

    Thumbs up Re: Complex issues in access

    Hi
    Thanks for your valuable suggesstion. I got the output. I have used Form's before update event and i got my expected output.

    Many Thanks

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

Similar Threads

  1. Learn MSAccess by playing MSAccess Jeopardy
    By pkstormy in forum Sample Databases
    Replies: 4
    Last Post: 11-17-2016, 07:27 AM
  2. SQL*Plus code in MsAccess, how to modify?
    By suverman in forum Queries
    Replies: 1
    Last Post: 05-20-2011, 07:01 AM
  3. Oracle to MSACCESS
    By karankukreja in forum Access
    Replies: 1
    Last Post: 03-24-2011, 08:20 AM
  4. MSAccess Runtime issue
    By tkanuradha in forum Security
    Replies: 4
    Last Post: 03-21-2011, 11:57 PM
  5. MSACCESS Query
    By saa18 in forum Access
    Replies: 0
    Last Post: 11-14-2008, 05:12 AM

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