Results 1 to 10 of 10
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    close a form if record is open and being edited

    I'd like a form to close if another user on the front end is editing the record

    I thought about the recordlocks property and setting it to 2 when they open a record (using current event)

    however I'd like to determine if the record is locked and if so close the form



    how would I go about this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Bing: access vba check if record locked

    See if this helps http://www.utteraccess.com/forum/che...-t1834320.html

    It's basically error trapping.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Bing: access vba check if record locked

    See if this helps http://www.utteraccess.com/forum/che...-t1834320.html

    It's basically error trapping.
    yeah I tried that (even found that exact page before and tried it)

    I open the record, do rs.edit and I get no error even though I have a user happily typing away in the field on another pc

    I even added rs.udate

    rs!name = stringsomething

    none of these brought up an error :-/

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Is RecordLock property set to 0? Seems that would be the only setting that would trigger error popup.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    What should it be? 2?

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Is RecordLock property set to 0? Seems that would be the only setting that would trigger error popup.
    Private Sub Form_Current()


    Debug.Print "record locks is " & Me.RecordLocks

    end sub

    pulls up 0 as result

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I think I have found a problem.

    To open the form I am using this

    Code:
    Public Sub OpenThisSchool(SchoolID As Long)
    If intCountFrmSchool > 3 Then
    
    
    MsgBox "You have opened too many school forms at one time, all other searched school forms now will close", vbExclamation
    
    
    Call CloseAllClients
    
    
    
    
    End If
    
    
    If intCountFrmSchool < 0 Then
    intCountFrmSchool = 0
    End If
    intCountFrmSchool = intCountFrmSchool + 1
    
    
    
    
      'Purpose:    Open an independent instance of form frmClient.
        Dim frm As Form
    
    
        'Open a new instance, show it, and set a caption.
        Set frm = New Form_frmSchoolsFound
        frm.Visible = True
        
        frm.Filter = "[NewSchoolsID] = " & SchoolID
        frm.FilterOn = True
        frm.Caption = "frmSchoolsFound"
        'Append it to our collection.
        clnClient.Add Item:=frm, Key:=CStr(frm.hwnd)
        
    '    Set frm = Nothing
    End Sub
    however any updated information is not showing in the record (so it's not giving me an updated view of the record)...

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    son of a $#%$#%$@#$


    I was using an old backup all this time

    slams a few doors and curses a lot.

  9. #9
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    ok correct database now but still same issue.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Sorry, that's all I've got. Never tried to code for this. Editing conflicts are so rare in our db. Think it's happened twice in 5 years and that was early in development.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Close one form open another and set focus to a specific field
    By Derrick T. Davidson in forum Programming
    Replies: 12
    Last Post: 08-01-2014, 05:16 AM
  2. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  3. Replies: 1
    Last Post: 05-10-2012, 09:32 AM
  4. Replies: 1
    Last Post: 05-03-2012, 02:25 PM
  5. Replies: 11
    Last Post: 01-26-2012, 01:22 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