[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Error, record has been changed by another user since you began editing, BUT there is only 1 user

Posted on 2008-06-13
2
Medium Priority
?
1,213 Views
Last Modified: 2013-11-28
I am building a clockin and a clockout form.  It's seems to be working great except !  I am running through some possible scenerios of how people might be able to cause errors and I have one.  I can't tell where its coming from hahahah.

The scenerio's are:  The user clocks in normally.  
1. They put their name and hit clockin
    OR
2. They choose their name and thier process# and then hit clockin.

The problem starts with the scenerio 1.  Leaving the process blank means they do not know at the time they started working what process it would be, but at the end when they clockout it gives them an option to enter the process#.  They have!! have have to have a process# when they clockout.  If they hit the clockout Command Button and there is no process_ID in the field  I have an if statement catch that and prompt them with a message box.  Then this is where the problem comes in somewhere.  after hitting ok on the message box, they then go and enter the processID into the field.  When they hit clockout again it says "This record has been changed by another user since you started editing it, if you save the record it will overwrite the changes.............."

Hahah I am attaching the code!.  I hope someone knows whats up with this!


Private Sub clockout1_Click()
 
    If emp_id >= 1 And process_id >= 1 Then
        lngAnswr2 = MsgBox("Is your Entry Correct ?", vbOKCancel + vbQuestion)
 
         If lngAnswr2 = vbOK Then    ' User chose Yes.
             CurrentDb.Execute "UPDATE dbo_timeclock SET clockout = Now() WHERE Emp_ID = " & Me.emp_id & " AND IsNull(clockout)"
             Me.Refresh
              Me.SetFocus
             DoCmd.Close    ' update timeclock table with clockout time and close form
           Else    ' User chose No.
            Me.Undo
            MsgBox "You have canceled your ClockIn!", _
             vbExclamation, "ClockIn Canceled!"
               Set Me.Recordset = Nothing
               DoCmd.CancelEvent '
                DoCmd.Close
 
          End If
    Else
                        
            MsgBox "Please Make sure you have entered your Clock Number!", _
             vbExclamation, "Did you forget your ClockIn #?"
    End If
  
End Sub

Open in new window

0
Comment
Question by:HarleySkater
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Author Comment

by:HarleySkater
ID: 21779348
I have tracked the problem to line number 7 of the original code snippet!

The record seems to be locked by the form if the process_id has changed since the form has been opened, and the update code is not able to run because the record is locked.  

What's an easy way to save the record before the code is run?  ie.   me.save
I hope that makes the problem easier to solve!  haha I have been working with the code for a good hour now.

CurrentDb.Execute "UPDATE dbo_timeclock SET clockout = Now() WHERE Emp_ID = " & Me.emp_id & " AND IsNull(clockout)"

Open in new window

0
 
LVL 1

Accepted Solution

by:
HarleySkater earned 0 total points
ID: 21779597
nm, got that too! haha it works now

                RunCommand acCmdSaveRecord
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question