Results 1 to 5 of 5
  1. #1
    stevewoo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    New Mexico
    Posts
    3

    Refresh form when values change

    I'm most of the way to where I want to be, but can't figure out the last step.

    I have a form that works on a single table. When the renewal date is changed, I want to set two other fields. That works fine via this:

    Private Sub RENEWAL_Change()


    If Me.Dirty Then
    Me.[last touched] = Date
    Me.Select = True
    Else
    End If
    End Sub

    What I'd also like if for those two fields, which are on the form, to be reflected on the form while I'm still viewing the record.

    As near as I can tell, "last touched" and select are both set as soon as the renewal date is changed, but they don't show up on the form unless I go to the next record and then back up.

    Thanks for your help!

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try this:
    Code:
    Private Sub RENEWAL_Change()
       If Me.Dirty Then
          Me.[last touched] = Date
          Me.Select = True
          
          'save the record
          Me.Dirty = False
       End If
    End Sub

  3. #3
    stevewoo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    New Mexico
    Posts
    3
    Thanks Steve! A couple of hours after I posted, I ended up with this, which seems to accomplish what I was after:

    Private Sub RENEWAL_Change()
    If Me.Dirty Then
    Me.[last touched] = Date
    Me.Select = True
    Me.Form.Refresh
    Else
    End If
    End Sub

    Now as soon as I change the renewal date the other two values change on my form.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Steve,

    Great...

    To help you in the future, there are some words that should not be used for object names; they will cause you major headaches. Here is a list of reserved words:

    http://allenbrowne.com/AppIssueBadWord.html

    You should use/develop a naming convention (there are lots). You have a field "Select" (a reserved word). Also, a word like "Select" (or "Date" or "Time") is not very descriptive. One doesn't have to write an essay to name an object, but it is easier to understand if the field name gives you a hint what is being stored...
    examples:"Select" what? (SelectOption)
    "Date" of what?? (BirthDate)

    Also, try not to use spaces or special characters (!@#$%^&*()?) except the dash (-) or underscore(_) in object names (more headaches).

    Have you seen

    The Ten Commandments of Access

    http://access.mvps.org/access/tencommandments.htm


    Happy coding...

  5. #5
    stevewoo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    New Mexico
    Posts
    3
    I ran across that site yesterday and understand, now, why all those are important!

    Thanks very much.

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

Similar Threads

  1. Access 2010 Refresh VS Refresh ALL
    By Snwboarder1982 in forum Access
    Replies: 1
    Last Post: 09-09-2011, 04:07 PM
  2. Verify values change before updating record
    By gopherking in forum Forms
    Replies: 6
    Last Post: 07-19-2011, 11:46 AM
  3. Change values on form that come from query
    By szucker1 in forum Forms
    Replies: 2
    Last Post: 06-10-2011, 07:04 PM
  4. Replies: 1
    Last Post: 12-14-2010, 10:03 PM
  5. refresh a form
    By RedGoneWILD in forum Forms
    Replies: 18
    Last Post: 09-03-2010, 08:31 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