Windows XP Help! Setting the value of one combo box based on another!

Joined
Jun 17, 2005
Messages
9
Reaction score
0
I am trying to create a form that has, among other controls, two combo boxes. The first combo box, named 'Group' is not bound to the query that I am updating on this form. It retrieves its values from a table with the same name, two fields named GroupID (the primary key) and GroupDescription. The second combo box, named 'Activity' is bound to the 'Type' field on the underlying query. It retrives its values from a table named 'ActivityDescriptions', a field named GroupID (the foreign key), a field named ActivityID (the primary key) and a field named Description.

What I need to do is select a group from the first combo box, and have the second combo box automatically populated with the values that match the GroupID. I got code to do this from http://office.microsoft.com/en-us/assistance/HA011730581033.aspx but it's not working properly. When I try to load the form, I get the following message:

The expression On Load you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name.

*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Below is the code for the subs on the form and the SQL statements for both combo boxes.


Option Compare Database

Private Sub Group_AfterUpdate()
Me.Activity = Null
Me.Activity.Requery
Me.Activity = Me.Activity.ItemData(0)
End Sub

Private Sub Form_Load(Cancel As Integer)
If IsNull(Group) Then
Me.Group = Me.Group.ItemData(0)
Call Group_AfterUpdate
End If
End Sub

RowSource for Combo Box: Group - SELECT Group.GroupID, Group.Description FROM [Group];

RowSource for Combo Box: Activity - SELECT ActivityDescriptions.ActivityID, ActivityDescriptions.Description, ActivityDescriptions.GroupID FROM ActivityDescriptions WHERE (((ActivityDescriptions.GroupID)=Forms![ActivityAndTrackingWithCalculations subform]!Group));

The Bound Column Property on both forms is set to 1, which was the default. I tried setting the Bound Column property on the Activity combo box to 3, but got the same error.

I hope someone can help me out with this.

Thanks,
Amanda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top