Hi Everyone
PBaldy offered me this code to use an Option Group to filter a form
Private Sub Frame45_AfterUpdate()
With Forms!PIInput
Select Case Me.Frame45
Case 1
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Ambulatory Care'"
Case 2
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Clinical Effectiveness'"
Case 3
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Community'"
Case 4
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Critical Care'"
Case 5
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Diagnostics'"
Case 6
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Family Services'"
Case 7
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Medicine'"
Case 8
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Surgery'"
Case 9
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Nursing'"
Case 10
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Medical Director'"
Case 11
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like '*'"
End Select
End With
DoCmd.Requery
Me.OrderBy = "DocumentCode"
Me.OrderByOn = True
DoCmd.GoToRecord , , acLast
End Sub
This worked But I have now done some more work and have normalised the tables and now want to filter on the corresponding ID field and need the code to work with Integers. I have spent hours trying to make it work with no success. Help?
Regards
PBaldy offered me this code to use an Option Group to filter a form
Private Sub Frame45_AfterUpdate()
With Forms!PIInput
Select Case Me.Frame45
Case 1
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Ambulatory Care'"
Case 2
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Clinical Effectiveness'"
Case 3
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Community'"
Case 4
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Critical Care'"
Case 5
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Diagnostics'"
Case 6
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Family Services'"
Case 7
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Medicine'"
Case 8
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Surgery'"
Case 9
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Nursing'"
Case 10
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like 'Medical Director'"
Case 11
.RecordSource = "SELECT * FROM PatientInformation WHERE Directorate Like '*'"
End Select
End With
DoCmd.Requery
Me.OrderBy = "DocumentCode"
Me.OrderByOn = True
DoCmd.GoToRecord , , acLast
End Sub
This worked But I have now done some more work and have normalised the tables and now want to filter on the corresponding ID field and need the code to work with Integers. I have spent hours trying to make it work with no success. Help?
Regards
