Results 1 to 12 of 12
  1. #1
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29

    How can I trigger a change in value in a field when the user types in another field

    The field that I want the change to occur in has the choices of "Active" and "Closed". All cases default to Active as a new record, but what I want to happen is to change it to "Closed" when the user types an entry in another field explaining the resolution to close the record.



    As it works now, the user must manually change the field to "Closed", but sometimes people forget.....
    I want to make it it automatic, when the user types the resolution (because they are closing the case), I want the status to change to "Closed"

    Or find some other way to close the status of the case.
    Thanks

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Is it possible that the field used to determine "resolution" will contain data that does not resolve/close the incident or will data in that field always indicate a closed resolution?

  3. #3
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29
    Quote Originally Posted by alansidman View Post
    Is it possible that the field used to determine "resolution" will contain data that does not resolve/close the incident or will data in that field always indicate a closed resolution?
    The field for resolution entry is strictly for entering the closure details of that case. Any other entries prior to closure take place in another field.

    I could also use a date field I have that the users have to click in to choose the "Closed date"

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Have you considered a Button --eg Click to Close This Case

    in the code for the click event

    if other required fields are populated Then
    update the record involved with a ClosedDate
    Else
    Put a message that says You have not completed the required fields
    End If

    OR

    Hide the button mentioned above until all required fields are valued
    then, make the button visible
    then Update the ClosedDate

    Just a few thoughts to consider

  5. #5
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29
    Thanks for that suggestion, I tried a simple macro that pops up a message reminding people to marked the status as closed as soon as they click on closed date field. Hopefully it works to remind them. But I would like to find a way to make it just happen when they make an entry in the resolution field.

  6. #6
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    you could also put an afterupdate event on the resolution field something like this:

    Code:
    If Isnull(ResolutionField) then
    me.closedField = Null
    Else
    me.closedfield.value = "closed"
    End if
    FYI--this has not been tested as I didn't recreate your issue.

    Alan

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Alan,

    IIRC if the Me.Closed control is expecting a string then you must use "" and not NULL.

  8. #8
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Orange--

    Excellent Point.

    Alan

  9. #9
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29
    Hi, I'm posting a resolution to this case, after I got help from someone I work with. We decided to tie the automatic change in Status value to the ClosedDate field as opposed to the ClosedDescription field as I originally used at the beginning of the thread.

    Now, when the user inputs a date in the ClosedDate field, the Status field value changes from the default "Active" to "Closed".
    Code

    Private Sub ClosedDate_Exit(Cancel As Integer)
    If IsDate(Me.ClosedDate.Value) Then
    Me.Status.Value = 2
    Else
    Me.Status.Value = 1
    End If
    End Sub

    (The reason Status.Value says 1 or 2 is because the Primary Key for Active is 1, and PK for Closed is 2 in my database)

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I don't think this has anything to do with PK. It is about the value you assign to Status to indicate Active or Closed.

    You may wish to review the meaning of Primary Key.
    see http://databases.about.com/cs/admini...primarykey.htm

  11. #11
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29
    Quote Originally Posted by orange View Post
    I don't think this has anything to do with PK. It is about the value you assign to Status to indicate Active or Closed.

    You may wish to review the meaning of Primary Key.
    see http://databases.about.com/cs/admini...primarykey.htm
    I could be confused about it, but in this database, the Status is a lookup table, and it happens to have those Primary keys for those particular values

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Could be?? What is it that is actually being closed? A project record? An Invoice?
    Please tell us about the whole application.
    In your Status look up table, the 1 and 2 are the PKs no doubt. But you have other records in which you populate the StatusCode or something similar with values from your lookup table to show that it is Active or Closed. It isn't clear what that something else is - to me at least.

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

Similar Threads

  1. Change Text field to Memo Field in a Query
    By Yarbz in forum Queries
    Replies: 5
    Last Post: 06-28-2012, 05:24 PM
  2. Changing field types
    By kwooten in forum Access
    Replies: 2
    Last Post: 06-12-2012, 07:40 AM
  3. Defining Field Types In A Make Table Query
    By jo15765 in forum Queries
    Replies: 2
    Last Post: 05-23-2012, 08:07 PM
  4. Field Types
    By ccordner in forum Access
    Replies: 2
    Last Post: 12-13-2011, 12:33 PM
  5. Field Types for a Linked Table
    By Jeff_J in forum Access
    Replies: 9
    Last Post: 05-05-2009, 07:12 AM

Tags for this Thread

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