Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link Combo Box and Query

Status
Not open for further replies.

eagle11232

Technical User
May 13, 2008
11
0
0
US
Hello all.

I am currently working with a form where I catagorize graduates of a University based on campus, degree level (BS, Master's, MBA, etc) and then major. All of these entries are done via combo boxes

Currently everything works, however, when I select the campus from its combo box, and then click on the degree combo box, the form prompts me to enter the campus I selected into a query popup.

The same thing happens when I select the major combo box, but that field requires both the campus and degree data to be re-entered into a query popup.

With that background, my question is: How do I automate the query function so that when a value is selected in the combo box, the data for the next combo box will automatically be queried?

Here are the SQL Statements

Campus Combo Box:
SELECT tblMajor.Campus
FROM tblMajor
GROUP BY tblMajor.Campus
ORDER BY tblMajor.Campus;

Degree Combo Box:
SELECT tblMajor.Degree
FROM tblMajor
WHERE (((tblMajor.Campus)=[forms]![COBContactsv11].[Campus1]))
GROUP BY tblMajor.Degree;


Major Combo Box:
SELECT tblMajor.Majors
FROM tblMajor
WHERE (((tblMajor.Degree)=[forms]![COBDevelopment].[Degree1]) AND ((tblMajor.Campus)=[forms]![COBDevelopment].[Campus1]))
GROUP BY tblMajor.Majors
ORDER BY tblMajor.Majors;

and here is all of the VB code for the database

Code:
Private Sub Campus1_AfterUpdate()
Me.Campus1.Requery
End Sub

Private Sub Campus2_AfterUpdate()
Me.Campus2.Requery
End Sub


Private Sub Degree2_AfterUpdate()
Me.Degree2.Requery
End Sub

Private Sub ERAUAlumni_AfterUpdate()

If (Me![ERAUAlumni].Value) = "Yes" Then
Me![Campus1].Visible = True
Me![Major1].Visible = True
Me![Degree1].Visible = True
Me![YearOfGrad1].Visible = True
Me![Campus2].Visible = True
Me![Major2].Visible = True
Me![Degree2].Visible = True
Me![YearofGrad2].Visible = True
Me![AlumniAssocMember].Visible = True
End If

If (Me![ERAUAlumni].Value) = "No" Then
Me![Campus1].Visible = False
Me![Major1].Visible = False
Me![Degree1].Visible = False
Me![YearOfGrad1].Visible = False
Me![Campus2].Visible = False
Me![Major2].Visible = False
Me![Degree2].Visible = False
Me![YearofGrad2].Visible = False
Me![AlumniAssocMember].Visible = False
End If

Me.ERAUAlumni.Requery

End Sub

Private Sub Major1_AfterUpdate()
Me.Major1.Requery
End Sub

Private Sub Major2_AfterUpdate()
Me.Major2.Requery
End Sub


Thank you all for your help!
 
faq702-4289

a look at the FAQs should help.

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top