Results 1 to 10 of 10
  1. #1
    bdonelson is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    5

    Two values for the same field


    I am hoping someone can at least point me in the right direction.

    I have a form with subroutines triggered to run when the record changes.

    The problem I am having is, a field appears to have two different values when monitoring in the Visual Basic Editor.
    When I hold the cursor over a field in the code it is different then value in the "locals" box below. The value displayed in the "locals" box is the one I excepting.

    If anyone has any ideas, I really would appreciate the help.

    Thanks,
    Bill
    Attached Thumbnails Attached Thumbnails VSB-Capture.JPG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    bdonelson is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    5
    Ok,
    I am including the database I'm working on.

    Database2.zip

    Thank you.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    The Unlock procedure runs when closing form. That seems odd.

    So the value for CurrentUserName is "bill". I see this in procedure and Watches. Then getUserName function runs and compares to CurrentUserName. CurrentUserName still has "bill".

    Not understanding issue.

    Is there a different process I should follow than closing form to replicate issue you describe?
    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
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    A highlighted line hasn't been processed. You have to execute it to force any assignments or calculations.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    bdonelson is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    The Unlock procedure runs when closing form. That seems odd.

    So the value for CurrentUserName is "bill". I see this in procedure and Watches. Then getUserName function runs and compares to CurrentUserName. CurrentUserName still has "bill".

    Not understanding issue.

    Is there a different process I should follow than closing form to replicate issue you describe?
    When would you suggest that I run the Unlock procedure? That sounds like where the problem is.

    Thank you.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    What is purpose of CurrentUsername field? Why do you change its value when navigating records? Why is it not changed in record when form is loaded?

    Why is MasterBill table included in [MasterBillRecords subform] RecordSource?

    Why does [CartonInfo subform] have RecordSource that pulls only ID field?
    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.

  8. #8
    bdonelson is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    What is purpose of CurrentUsername field? Why do you change its value when navigating records? Why is it not changed in record when form is loaded?

    Why is MasterBill table included in [MasterBillRecords subform] RecordSource?

    Why does [CartonInfo subform] have RecordSource that pulls only ID field?
    I am attempting to use CurrentUsername to identify when the Current Record needs to be locked. I am changing when navigating records, because the user needs to hold only one record.

    I am using a field in the MasterBill table to filter the subform.

    The CartonInfo subform is an unfinished item.

    I realize that I might be using the wrong approach with the CurrentUsername and LockRecord fields, but that is the best I have been able to come up with so far.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Bill,
    It may be more efficient to getting a focused response if you provide a description in simple English - no database jargon -- of what you are trying to do. Why would a record need to be locked --you know, we don't and it's key that readers understand the need/requirements before jumping into Access terms and physical database.
    Whether or not your current approach is "wrong" really depends on what you are trying to accomplish and what options are feasible.
    Bottom line -- design before you build.

    Good luck with your project.

  10. #10
    bdonelson is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    5
    I have decided to focus on locking a record and associated records without doing it automatically based on username.

    Thank you for everyone's suggestions.

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

Similar Threads

  1. Replies: 4
    Last Post: 01-12-2018, 02:58 PM
  2. Replies: 2
    Last Post: 05-17-2017, 06:17 AM
  3. Replies: 18
    Last Post: 03-26-2015, 07:26 AM
  4. Replies: 1
    Last Post: 02-19-2014, 11:07 AM
  5. Replacing many values at once in a multiple values checkbox field.
    By ConfusedDatabaseDesigner in forum Forms
    Replies: 2
    Last Post: 07-20-2012, 08:58 AM

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