L
Linda RQ
Hello Everyone,
I made the mistake of trying to get a little fancy and agreed to try some
code with help....but the help is out of town now. I need help
troubleshooting my combo box. I have 2 on my form. One to look up patients
by last name and one to look up my patients by room number. I am assuming
if I can get the one fixed, I can do the other. I have copy and pasted the
code below. The first sub is for the combo box and the second is for my
option group. I finally got my option group to work after a huge struggle
and I suspect the combo box doesn't work because of my option group or maybe
it's the underlying query for the combo? I pasted the sql for my cboqry
here too in case that will help. If I can get this to work, I think I'll be
happy with my database and I promise not to use code ever again!...Thanks,
Linda
Private Sub Combo73_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PtLName] = '" & Me![Combo73] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Row Source is this query
SELECT qryActivePatients.PtID, qryActivePatients.PtLocRmNum,
qryActivePatients.PtLName, qryActivePatients.PtFName
FROM qryActivePatients
ORDER BY qryActivePatients.PtLocRmNum, qryActivePatients.PtLName,
qryActivePatients.PtFName;
Column count is 4
Column widths are 0";0.25";0.5";0.5"
Private Sub opgpActiveAndInactivePatients_AfterUpdate()
If Me.opgpActiveAndInactivePatients = 1 Then
Me.RecordSource = "qryActivePatients"
Me.Requery
Me.sfmPtLocation.Form.RecordSource = "qrysbfrmPtLocation"
Me.sfmPtLocation.Requery
Me.sfmPtThpy.Form.RecordSource = "qryfrmPtThpy"
Me.sfmPtThpy.Requery
Me.Combo78.RowSource = "qrycboLocatePtByLName"
Me.Combo78.Requery
Me.Combo73.RowSource = "qrycboLocatePtByRm"
Me.Combo73.ColumnCount = 4
Me.Combo73.Requery
Else
Me.RecordSource = "qryInactivePatients"
Me.Requery
Me.sfmPtLocation.Form.RecordSource = "qrysbfrmPtLocationWithEndDate"
Me.sfmPtLocation.Requery
Me.sfmPtThpy.Form.RecordSource = "qryfrmPtThpyWithEndDate"
Me.sfmPtThpy.Requery
Me.Combo78.RowSource = "qrycboLocatePtByLNameInactive"
Me.Combo78.Requery
Me.Combo73.RowSource = "qrycboLocatePtByRmInactive"
Me.Combo73.ColumnCount = 5
Me.Combo73.Requery
End If
End Sub
I made the mistake of trying to get a little fancy and agreed to try some
code with help....but the help is out of town now. I need help
troubleshooting my combo box. I have 2 on my form. One to look up patients
by last name and one to look up my patients by room number. I am assuming
if I can get the one fixed, I can do the other. I have copy and pasted the
code below. The first sub is for the combo box and the second is for my
option group. I finally got my option group to work after a huge struggle
and I suspect the combo box doesn't work because of my option group or maybe
it's the underlying query for the combo? I pasted the sql for my cboqry
here too in case that will help. If I can get this to work, I think I'll be
happy with my database and I promise not to use code ever again!...Thanks,
Linda
Private Sub Combo73_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PtLName] = '" & Me![Combo73] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Row Source is this query
SELECT qryActivePatients.PtID, qryActivePatients.PtLocRmNum,
qryActivePatients.PtLName, qryActivePatients.PtFName
FROM qryActivePatients
ORDER BY qryActivePatients.PtLocRmNum, qryActivePatients.PtLName,
qryActivePatients.PtFName;
Column count is 4
Column widths are 0";0.25";0.5";0.5"
Private Sub opgpActiveAndInactivePatients_AfterUpdate()
If Me.opgpActiveAndInactivePatients = 1 Then
Me.RecordSource = "qryActivePatients"
Me.Requery
Me.sfmPtLocation.Form.RecordSource = "qrysbfrmPtLocation"
Me.sfmPtLocation.Requery
Me.sfmPtThpy.Form.RecordSource = "qryfrmPtThpy"
Me.sfmPtThpy.Requery
Me.Combo78.RowSource = "qrycboLocatePtByLName"
Me.Combo78.Requery
Me.Combo73.RowSource = "qrycboLocatePtByRm"
Me.Combo73.ColumnCount = 4
Me.Combo73.Requery
Else
Me.RecordSource = "qryInactivePatients"
Me.Requery
Me.sfmPtLocation.Form.RecordSource = "qrysbfrmPtLocationWithEndDate"
Me.sfmPtLocation.Requery
Me.sfmPtThpy.Form.RecordSource = "qryfrmPtThpyWithEndDate"
Me.sfmPtThpy.Requery
Me.Combo78.RowSource = "qrycboLocatePtByLNameInactive"
Me.Combo78.Requery
Me.Combo73.RowSource = "qrycboLocatePtByRmInactive"
Me.Combo73.ColumnCount = 5
Me.Combo73.Requery
End If
End Sub