Help with AfterUpdate Event

jereece

Registered User.
Local time
Today, 23:47
Joined
Dec 11, 2001
Messages
300
I have a form [frmData] that has 3 combo boxs (cboStatus, cboCommittment and cboAssignedTo). Once the user selects the status, I am using an After Update Event to update the records showing. Here are my problems.

1. I have the default value for cboStatus to "Open" but the report when opened shows all records. It's not reflective of the default setting of Open for cboStatus. How can I make this happen on opening the form?

2. When using the 3 filters, it's like things get confused. Let say I assign cboStatus to Open, cboCommittment to Yes and cboAssignedTo to Tom. Then I go back and change cboCommittment to No. It loses the previous settings so now records are showing that should not be per the other combo boxes. For example cboStatus will have previously be set to Open but now it shows Open and Closed items. How can I keep the 3 combo boxes in sync?

Thanks,
Jim
 
Last edited:
I don't follow exactly what you're doing here, but the problem is that many events, including the AfterUpdate event, only fires if the user physically makes a selection from the combobox. Making a selection thru code, which is what you're doing when you assign a default value to it, doesn't fire the event. You either need another independently call the event

cboStatus_AfterUpdate


or figure another way to trigger your code, wherein you check the value of cboStatus then do your thing!
 
I resolved problem #1 by adding the following code to the OnLoad event

Code:
  If IsNull(Me.cbo_StatusComboBox) Then
        Me.FilterOn = False
    Else
        Me.Filter = "Status = """ & Me.cbo_StatusComboBox & """"
        Me.FilterOn = True
    End If

I still have Problem #2. Again on my form I have 3 filters that update the records being shown. The filters are Status, AssignedTo and Committment. On each of the combo boxes I am using similar code as shown above to the AfterUpdate event for the combo box. The problem however is when I try to use the combo boxes together to filter records. So if I initially click on Status = Open, that works fine and the form only shows me the Open records. However if I then click on AssignedTo and select a name, the form then shows me the records assigned to that person regardless if the status is Open or not. So the combo boxes ignore the selection of the other combo boxes. How do I get them to remember the others so they work together?

I have attached my "Action Register" database if someone wants to look at it. My problem is on the "Manage Action Items" form.

Question: Is there some way I can use the following code in the Query the form is based on then have some kind of AfterUpdate event to refresh the form?

Code:
[Forms]![frmData]![cbo_AssignedToComboBox] Or Like [Forms]![frmData]![cbo_AssignedToComboBox] & "*"


I appreciate any help.

Jim
 

Attachments

Last edited:
I'm sorry, I was referring to the form that "Manage Log Items" button brings up. The form name is frm_Data.

Thanks,
Jim
 
I am not trying to use Cascading Combo Boxes. I just want the combo boxes to work together to remember their settings.

Would it work if I added the filter code for all 3 combo boxes to each combo box? See Code:

Code:
    If IsNull(Me.cbo_StatusComboBox) Then
        Me.FilterOn = False
    Else
        Me.Filter = "Status = """ & Me.cbo_StatusComboBox & """"
        Me.FilterOn = True
 
    If IsNull(Me.cbo_AssignedToComboBox) Then
        Me.FilterOn = False
    Else
        Me.Filter = "AssignedTo = """ & Me.cbo_AssignedToComboBox & """"
        Me.FilterOn = True
 
    If IsNull(Me.cbo_Committment) Then
        Me.FilterOn = False
    Else
        Me.Filter = "Committment = """ & Me.cbo_Committment & """"
        Me.FilterOn = True
    End If
 

Users who are viewing this thread

Back
Top Bottom