• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

Run-Time Errror 424 - Object Required

I've read through plenty of postings on here regarding this message, but did not find one that suited my needs.  I have "frmProfile" that has a tabbed control on it, "ProfileTab".  On the first page, "Profile", Index(0), I have "cmbExemptStatus", a combo box that applies to an employee.  What I need is when the user changes the selection in that combo box, it filters a combo box, "cmbBenefitsStatus" on another page, "Benefits", Index (2).  

For example, if the user selects "Exempt" from the dropdown menu, it only displays options in cmbBenefitsStatus that apply to an exempt employee.  

I have posted what I have for it as of now.
Private Sub cmbExemptStatus_Change()
    
    If cmbExemptStatus = "Exempt" Then
       Me.ProfileTab.Pages(2).SetFocus
       cmbBenefitsStatus.RowSource "SELECT [benefits_dependant_status].[status_desc] FROM [benefits_dependant_status] WHERE [benefits_dependant_status].[status_desc] LIKE 'Salaried'"
   End If
    
End Sub

Open in new window

0
njmatt
Asked:
njmatt
  • 4
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:
might be better seeing what you have in that form.

can you attache your db here.. click Attach file below
0
 
Jeffrey CoachmanCommented:
njmatt,

Can you tell us what happens when you run the code you have please.
Thanks.


If the two comboboxes are on the same tab this is easy.
If the two combos are on separate tabs it becomes hard.

Can both combos be on the same tab?

JeffCoachman

0
 
njmattAuthor Commented:
Unfortunately, the combo boxes are on separate tabs and need to be so.  On the attached file, if you open 'frmProfile'.  You will see "Exempt Status" on the first Profile Tab.  By changing that combo box, it should update the "Benefits Plan" combo box on the "Benefits" tab.

If Exempt Status = Exempt, Benefits Plan should display only options for Salaried.
If Exempt Status = Non-Exempt, Non-Employee, Benefits Plan should display options for Hourly and Cobra.

Thanks for all your help.
IMED-TEST-2.zip
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Rey Obrero (Capricorn1)Commented:
try this


Private Sub cmbExemptStatus_Change()
Dim sql
If cmbExemptStatus = "Exempt" Then
    sql = "SELECT [benefits_dependant_status].[status_desc] FROM [benefits_dependant_status] WHERE [benefits_dependant_status].[status_desc] LIKE 'Salaried*'"
    Me.frmProfile_benefits_subform.SetFocus
    Me.frmProfile_benefits_subform.Form.cmbBenefitsStatus.RowSource = sql
End If
   
End Sub
0
 
Rey Obrero (Capricorn1)Commented:
now, that will solve your problem of runtime error object required.

to make the selection options dynamic in combo cmbBenefitsStatus,

you need to make a relation between tables person_exempt_status and  benefits_dependant_status
0
 
njmattAuthor Commented:
I got that to somewhat work for me.  A few things are happening that I don't understand.  

1.  When I make a selection in the Exempt Status combo box, the form jumps right to the Benefits Tab, which I don't want to happen.
2.  When I try to select an option in the Benefits Plan combo box, I get the following message:

"You tried to assign the Null value to a variable that is not a Variant data type."

3.  After I select, for example "Exempt" in the Exempt Status combo box, if I were to go back and change the selection, "Non-Exempt" disappears and the options are Exempt, Exempt, Non-Employee.  Also occurs if I select "Non-Employee", the combo box then reads Exempt, Non-Employee, Non-Employee.  And if you are to open up the person_exempt_status table, you'll see that the values will be replaced.

I've re-attached with the updated code.




IMED-TEST-21.zip
0
 
Rey Obrero (Capricorn1)Commented:
1.  When I make a selection in the Exempt Status combo box, the form jumps right to the Benefits Tab, which I don't want to happen.

Private Sub cmbExemptStatus_Change()
Dim sql
If cmbExemptStatus = "Exempt" Then
    sql = "SELECT [benefits_dependant_status].[status_desc] FROM [benefits_dependant_status] WHERE [benefits_dependant_status].[status_desc] LIKE 'Salaried*'"
    Me.frmProfile_benefits_subform.SetFocus
    Me.frmProfile_benefits_subform.Form.cmbBenefitsStatus.RowSource = sql
End If
Me.ProfileTab.Pages(0).SetFocus '<<< ADD this line
End Sub


as for the other issues

see line three of my previous comment ...

and better post a new question for that
0
 
njmattAuthor Commented:
Thanks for you're help.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now