DomFino
10-03-2005, 05:59 PM
Hi everyone,
I am at a loss with regard to the following:
I have a form (frmRequisitionDetail) that has a query as the record source. On the form I have an Option Group with 7 selections. Selection 1 through 6 are for individuals and Selection 7 is for ALL.
What I am trying to do is have the form open with option 7 (show ALL records) as the default. Then a user can select their individual option (1 through 6) to see just their records displayed on the form.
Here is the SQL for my form query:
SELECT tblVacancyMaster.MasterID, tblVacancyMaster.PriorityID, tblVacancyMaster.Salary,
tblVacancyMaster.SubNumber, tblVacancyMaster.StatusID, tblVacancyMaster.VacancyID,
afrequis.o_recruit, afrequis.o_company, tblPriorityLKU.PriorityDesc, tblStatusLKU.StatusDesc,
tblVacancyLKU.VacancyDesc, afrequis.code, afrequis.desc, tblVacancyMaster.NumberVacancies,
tblVacancyMaster.NumberSubmittals, afrequis.o_opendte, tblVacancyMaster.DateNeeded,
(Date()-[o_opendte]) AS [Days Open], tblVacancyMaster.SourcerCode, tblVacancyMaster.EmailSent
FROM (tblVacancyLKU RIGHT JOIN (tblStatusLKU RIGHT JOIN (tblPriorityLKU
RIGHT JOIN tblVacancyMaster ON tblPriorityLKU.PriorityID = tblVacancyMaster.PriorityID)
ON tblStatusLKU.StatusID = tblVacancyMaster.StatusID) ON tblVacancyLKU.VacancyID =
tblVacancyMaster.VacancyID) LEFT JOIN afrequis ON tblVacancyMaster.SourcerCode =
afrequis.code
WHERE (((tblVacancyMaster.StatusID) <> 2))
ORDER BY afrequis.code;
Here is the code behind the Option Group:
Private Sub Select_Record_AfterUpdate()
If Me.Select_Record.Value = 7 Then
DoCmd.RunCommand acCmdRemoveFilterSort
End If
If Me.Select_Record.Value = 6 Then
DoCmd.ApplyFilter , "[MDL] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 5 Then
DoCmd.ApplyFilter , "[JLE] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 4 Then
DoCmd.ApplyFilter , "[DR] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 3 Then
DoCmd.ApplyFilter , "[GMK] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 2 Then
DoCmd.ApplyFilter , "[AM] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 1 Then
DoCmd.ApplyFilter , "[ALD] = " & Me.Select_Record.Value
Else
DoCmd.ApplyFilter , "[All] = " & Me.Select_Record.Value
End If
End Sub
My gut tells me I am going about this all wrong so any guidance you can offer will be much appreciated.
Thanks,
Dom
I am at a loss with regard to the following:
I have a form (frmRequisitionDetail) that has a query as the record source. On the form I have an Option Group with 7 selections. Selection 1 through 6 are for individuals and Selection 7 is for ALL.
What I am trying to do is have the form open with option 7 (show ALL records) as the default. Then a user can select their individual option (1 through 6) to see just their records displayed on the form.
Here is the SQL for my form query:
SELECT tblVacancyMaster.MasterID, tblVacancyMaster.PriorityID, tblVacancyMaster.Salary,
tblVacancyMaster.SubNumber, tblVacancyMaster.StatusID, tblVacancyMaster.VacancyID,
afrequis.o_recruit, afrequis.o_company, tblPriorityLKU.PriorityDesc, tblStatusLKU.StatusDesc,
tblVacancyLKU.VacancyDesc, afrequis.code, afrequis.desc, tblVacancyMaster.NumberVacancies,
tblVacancyMaster.NumberSubmittals, afrequis.o_opendte, tblVacancyMaster.DateNeeded,
(Date()-[o_opendte]) AS [Days Open], tblVacancyMaster.SourcerCode, tblVacancyMaster.EmailSent
FROM (tblVacancyLKU RIGHT JOIN (tblStatusLKU RIGHT JOIN (tblPriorityLKU
RIGHT JOIN tblVacancyMaster ON tblPriorityLKU.PriorityID = tblVacancyMaster.PriorityID)
ON tblStatusLKU.StatusID = tblVacancyMaster.StatusID) ON tblVacancyLKU.VacancyID =
tblVacancyMaster.VacancyID) LEFT JOIN afrequis ON tblVacancyMaster.SourcerCode =
afrequis.code
WHERE (((tblVacancyMaster.StatusID) <> 2))
ORDER BY afrequis.code;
Here is the code behind the Option Group:
Private Sub Select_Record_AfterUpdate()
If Me.Select_Record.Value = 7 Then
DoCmd.RunCommand acCmdRemoveFilterSort
End If
If Me.Select_Record.Value = 6 Then
DoCmd.ApplyFilter , "[MDL] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 5 Then
DoCmd.ApplyFilter , "[JLE] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 4 Then
DoCmd.ApplyFilter , "[DR] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 3 Then
DoCmd.ApplyFilter , "[GMK] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 2 Then
DoCmd.ApplyFilter , "[AM] = " & Me.Select_Record.Value
End If
If Me.Select_Record.Value = 1 Then
DoCmd.ApplyFilter , "[ALD] = " & Me.Select_Record.Value
Else
DoCmd.ApplyFilter , "[All] = " & Me.Select_Record.Value
End If
End Sub
My gut tells me I am going about this all wrong so any guidance you can offer will be much appreciated.
Thanks,
Dom