Results 1 to 14 of 14
  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Status Message (2003)

    Hi,

    Current I am building a database to track each case's status (Open, Pending, Close) and I use Toggle Button for each case. User will click Open toggle button if case is open. After a period, if case is pending, user is going to unclick open toggle button and click open toggle button. If case is close, user is going to change from Pending to Close.

    My question is how can I create a status message in form to shows each status change on current case. Because maybe user want to know when did the case changed from pending to open if current status is open.

    So I would like have to status process message in the form:

    1) If user click Open toggle button on 1/1/2007, the message on the form is going to show "Open on 1/1/2007."
    2) If user Unclick Open and Click Pending toggle button on 2/1/2007, the same message is going to show "Open on 1/1/2007; Pending on 2/1/2007."
    3) If user Unclick Pending and Click Close toggle button on 3/1/2007, the same message is going to show "Open on 1/1/2007; Pending on 2/1/2007; Close on 3/1/2007."

    I am really appreciate all of your helps.

    Regards

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    Does the user have to toggle OFF "Open" and toggle ON "Pending" in two separate clicks? If so, the user can select several statuses at once, for example "Open" AND "Pending". Is that OK? If not, you should use an option group with toggle buttons instead of individual toggle buttons.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Hi Hans,

    Yes, you are right. Since user have to select one of three status (Open or Pending or Close), so I am going to use option group with toggle button. Then I have following questions:

    1) SInce option group only store numbers for values. So I assign 1 as Open, 2 as Pending, 3 as Close. Is a way to store word than number in status field of my table?
    2) How to put If statement in onclick event of each toggle button to appear text fields if user click button? If user unclick button, then text fields are going to disappear.

    Thanks

    Regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    1) The option group will store a number value in the table. That is much more efficient than storing the entire description.

    Create another small table tblStatus:

    <table border=1><td>StatusID</td><td>[/StatusText[/b]</td><td align=right>1</td><td>Open</td><td align=right>2</td><td>Pending</td><td align=right>3</td><td>Close</td></table>
    StatusID is the Primary Key of the table.
    You can create a query based on your original table and tblStatus, joined on the StatusID field, and add the StatusText field as well as the fields from the table. This way, you can use the descriptive text on a form or in a report.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    2. With an option group, you don't use the On Click event of the individual buttons, but the After Update event of the option group as a whole. For example (with fictitious names):

    Private Sub grpStatus_AfterUpdate()
    Select Case Me.grpStatus
    Case 1 ' Open
    Me.txtThis.Visible = True
    Me.txtThat.Visible = False
    Case 2 ' Pending
    ...
    Case 3 ' Closed
    ...
    End Select
    End Sub

  6. #6
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Thank you so much, Hans.

    The codes is works. I am able to see each text fields if I click one of three button. But If I want to add a new case, the button that I Clicked before are also shows in current new case windows with fields are appear which suppose are disappear. So do I need add some codes to make option group as default after I udpate it? Or how can I to prevent it happens?

    Thanks

    Regards

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    You can add code to the On Current event of the form itself to hide/show text boxes as needed:

    Private Sub Form_Current()
    ' code to hide / show text boxes
    ...
    End Sub

  8. #8
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Thanks, Hans.

    Everything works fine except if I search the data which have been entered in database, only shows toggle button but not the text field.

    I have attached the database.

    Thank you so much for all your help.

    Regards

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    In my previous reply I wrote that you should create a Form_Current event to show/hide the text boxes. You haven't done that yet.

  10. #10
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Hi Hans,

    I add the following code in Form_Current event:

    Private Sub Form_Current()
    If Me.Toggle11.Value = True Then
    Me.lblOpenComments.Visible = True
    Me.OpenComments.Visible = True
    Else
    Me.lblPendingComments.Visible = False
    Me.PendingComments.Visible = False
    Me.lblClsoeComments.Visible = False
    Me.CloseComments.Visible = False
    If Me.Toggle12.Value = True Then
    Me.lblPendingComments.Visible = True
    Me.PendingComments.Visible = True
    Else
    Me.lblOpenComments.Visible = False
    Me.OpenComments.Visible = False
    Me.lblClsoeComments.Visible = False
    Me.CloseComments.Visible = False
    If Me.Toggle13.Value = True Then
    Me.lblClsoeComments.Visible = True
    Me.CloseComments.Visible = True
    Else
    Me.lblOpenComments.Visible = False
    Me.OpenComments.Visible = False

    Me.lblPendingComments.Visible = False
    Me.PendingComments.Visible = False

    End If
    End If
    End If
    End Sub

    I got "Run-time error "2427" You entered an expresion that has no value message. I even try "If Me.Toggle11.Value = 0 Then"

    Please help.

    Thanks

    Regards

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    I already told you that you shouldn't look at the value of the individual toggle buttons, but at the value of the option group. In fact, the only thing you need to do is to call the After Update event procedure of the option group from the On Current event of the form:

    Private Sub Form_Current()
    opgStatus_AfterUpdate
    End Sub

    See attached version.

  12. #12
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Thank you so much, Hans.

    I am really appreciating it.

    Regards

  13. #13
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Status Message (2003)

    Hi Hans,

    I hope this is the last question regarding toggle buttons. If user change the status from Open to pending (Unclick Open button, then click Pending button), I would like to have a message appears with Open Case Comments field. The message will shows like "Open on 1/1/2007). So how should I do it?

    Thanks

    Regards

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Status Message (2003)

    This makes it a bit more complicated, since you only want to change the comment when the user clicks a tobble button, not when the user searches for a record.. So the code to show or hide comments must be called from the After Update event of the option group AND from the On Current event of the form, and the code to change the comment must ONLY be called from the After Update event of the option group. See attached version.

Posting Permissions

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