lock records on keyword locks whole table

murray83

Games Collector
Local time
Today, 12:10
Joined
Mar 31, 2017
Messages
873
Code:
If Me.Status = "done" Then
Me.ActionedBy.Locked = True
    Else
    If Me.Status = "waiting" Then
    Me.ActionedBy.Locked = False
End If
    End If

this code is slowlly driving me crazy it works but then once i set it to done it locks and wont allow next record to have actioned by filled in

how can i differtiate between rows in records ?

sorry its zipped its 7mb for some reason and only has 2 forms and two tables
 

Attachments

Last edited:
if this is a continuous form use conditional formatting for each control

something like

expression is...[Status]='done'

and set the continuous formatting enabled to false
 
sorry to be a pain could you supply a quick screen shot of what you mean

ta
 
I run v2007 and apparently your file is in a later version, so I can't open it, but this is one of the rare times when formatting like this can be done, in VBA code, even on Continuous or Datasheet View Forms. But the problem, here, I suspect, is where you have the code!

Placed in the Form_Open or Form_Load event, it'll act as you describe. To be Record-appropriate, it needs to be placed in the Form_Current event.

I'm assuming that you also want the Field unlocked if you're entering a New Record, where Me.Status isn't equal to 'done' or 'waiting.' If this is so I'd use

Code:
Private Sub Form_Current()

 If Me.Status = "done" Then
   Me.ActionedBy.Locked = True
 Else
   Me.ActionedBy.Locked = False
 End If

End Sub
Linq ;0)>
 
Last edited:
sorry to be a pain could you supply a quick screen shot of what you mean
see this - but note that with disabled you lose the color

attachment.php



Note also that because your endtime is an unbound control, it's value will change every time you open the form - instead you need some code in the after update event of the status control

Code:
if status="done" then endtime=now()
 

Attachments

  • Capture.JPG
    Capture.JPG
    34.7 KB · Views: 136

Users who are viewing this thread

Back
Top Bottom