Solved

Run-Time Errror 424 - Object Required

Posted on 2008-10-03
8
374 Views
Last Modified: 2013-11-28
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
Comment
Question by:njmatt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22635164
might be better seeing what you have in that form.

can you attache your db here.. click Attach file below
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22644529
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
 
LVL 1

Author Comment

by:njmatt
ID: 22649699
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22649877
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22649930
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
 
LVL 1

Author Comment

by:njmatt
ID: 22650364
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 22650674
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
 
LVL 1

Author Comment

by:njmatt
ID: 22651082
Thanks for you're help.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question