Results 1 to 6 of 6
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    Lock/unlock current record in continous form ?

    Hi,

    I want to lock or unlock current record in continous form. I know that is probably impossible, but I'm looking for some ideas on how could I accomplish this, at least in way
    that User would think only his selected record is being unlocked.



    I have tried some form_current events, but seems like It's not working for my case, since my design is a little bit different that ones posted in forums.


    Here It is (sample picture but same design in my DB - lock button is toggle button, not bounded to table, just added in design of detail section ):
    Click image for larger version. 

Name:	SamplePic.jpg 
Views:	20 
Size:	43.1 KB 
ID:	23706

    So far I tried this :

    Code:
    Private Sub Form_Load()
    
    'On open lock all fields and set Toggle to True
    Me.Name.Locked = True
    Me.Description.Locked = True
    Me.Date_Of_Entry.Locked = True
    Me.HyperLink.Locked = True
    Me.Toggle1.Value=True
    End Sub
    Code:
    Private Sub Toggle1_Click()
    
    
    
    If Toggle1.Value = False Then
      
    Me.Name.Locked = False
    Me.Description.Locked = False
    Me.Date_Of_Entry.Locked = False
    Me.HyperLink.Locked = False
     
    ElseIf Toggle1.Value = True Then
    
    
    Me.Name.Locked = True
    Me.Description.Locked = True
    Me.Date_Of_Entry.Locked = True
    Me.HyperLink.Locked = True 
    
    
    End If
    
    End Sub
    This is a simple code which works, only problem is that all toggle buttons change their True/False state when user clicks on It. Desirable would be that only current record's Toggle would change (different color and option too).


    So, as I said, I'm loking something that would look like It's unlocking/locking only current record in continous form, toggle button can be moved outside form too (but then focus to current record is a problem).

    Any help appreciated, or suggestions for different design to achieve locking/unlocking current records, thank you in advance !!

  2. #2
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Found solution that works, finally

    1. I added another YES/NO field to my table - by default that is checkbox

    2. Added checkbox to design of my table in continous form

    3. Pasted above code in click_event of checkbox, and form load as before

    4. Changed checkbox to toggle button (in right-click menu - "change to")

    Now "toggle button" locks only current record If needed, and design stays the same + toggle button changes state in one record only


    Any other solutions without interfering table design ?? Please answer !!

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    If you show the Record selectors for the record you will be able to see the lock state of the records. You may wish to change the default record locking for the current database.

  4. #4
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Not sure what you think, with record selectors continous form behaves same way - whatever you change in one field, It affects all other same controls in different rows.

    I think you have to do It like in my previous post, without adding YES/NO field in table is this probably not possible. Beside that, record selectors are something I tend to avoid in form designs.

  5. #5
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    My autistic mind thinks autistic things naturally . Record selectors are also available in datasheet view.

    If your up for a less simplistic approach, you can make class modules and use them to manage your data instead of the built in access way. This would permit you to have "can edit" property and what not.

    I think the issue with me.name.locked will lock all records within the form for that control and not just the one. You could modify the keypress event to check for the value of that record and set the keyascii to 0 if the record is set to locked.

  6. #6
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Thanks, but I'll stick to my solution. It's simple, nice design and works as It should

    I don't love less simplistic approaches while I'm in process of creating app, It takes too long, and users are usually impatient

    I'm closing this thread.

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

Similar Threads

  1. Replies: 16
    Last Post: 02-13-2016, 10:21 AM
  2. Replies: 4
    Last Post: 08-19-2015, 12:56 PM
  3. Replies: 3
    Last Post: 01-26-2014, 06:32 PM
  4. Lock Focus on the Current Form
    By injanib in forum Forms
    Replies: 6
    Last Post: 05-29-2011, 04:22 AM
  5. Replies: 0
    Last Post: 03-08-2009, 05:12 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