Results 1 to 9 of 9

Thread: Easy question

  1. #1
    Join Date
    Oct 2007
    Posts
    214

    Question Unanswered: Easy question

    This question is probably easy, but I just want to be sure I have it right. I have a form that contains data and the user can input data then when the record saves it locks. However, when the user wants to go back to that record they must unlock it before making any field changes etc. How could I create a message box that states "You must unlock" when the user tries to type or click a combo or check box and make a change? What is the best code and in what event would it be used? Thank you!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    there is no must about lock/unlock, unless you have set up some code to do that

    if you mean record locking then thats a setting in your db. generally I use optimistic locking, although on more recent db's (2007 on) I use record locking
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2007
    Posts
    214
    I'm sorry I should have specified, I have it set to lock when the record saves / user moves to next record. When the user wants to go back and make changes they must hit unlock, however if the user does not know to hit unlock, I'm looking to make a prompt to advise them of this as they attempt to make a change. Thank you.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    use rhe message box msgbox function
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    How, exactly, are you 'locking' the Records?

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Oct 2007
    Posts
    214
    Missinglinq,

    I am using me.allowedits = false in the form current event.

    I need something that prompts a user to "unlock" if they try to enter data and the record is locked. Thanks!

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    First, I wouldn't use a MessageBox; it will require that the user clears it before editing the Record, which could get very tiresome for the users.

    Secondly, if you tie this to the user clicking on a Control, to change it, you'll have to run code from all Controls on the Form, which could get tiresome for you!

    Instead I'd place a Label on the Form, make it noticeable, maybe with a bright Back Color, and control its Visible Property depending on whether the Record is New, i.e. unsaved, or not, using code like this:
    Code:
    Private Sub Form_Current()
     If Not Me.NewRecord Then
      Me.WarningLabel.Visible = True
     Else
      Me.WarningLabel.Visible = False
     End If
    End Sub

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Join Date
    Oct 2007
    Posts
    214
    This worked great thank you for the quck help! I appreciate it.

  9. #9
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    Good luck with your project!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •