A
Asib
Hello all. This is my situation. I have a main form [frmMain] with a tab
control. the tab control has 5 tabs all with there own subform. I have found
myself having to use a workaround for the fact that the subform is not
isolated (i have read allen brownes bug description and that is what im up
against)from the mainforms remove filter button docmd.showallrecords(Code
below). Basicly when i push the button i was removing the filter of the main
form. which worked fine.But now with the 5th tabs subform being set to data
entry, when i use the showallrecords or me.filter = false it is setting the
data entry subform to the first record in the table.
What i am now trying to accomplish is when the user clicks the remove
filter btn the code checks to see what the current subform is and removes the
filter without removeing focus from the subform that is curently being
viewed. I am rather new to VBA and cant seem to find the right syntax for the
code. Any and all help is greatly appretiated. Thanks Asib
Private Sub btnRemoveFilter_Click()
On Error GoTo Err_handler
'DoCmd.Echo False
DoCmd.ShowAllRecords
If Me.[sbfrmNotes].Screen.ActiveForm Then
Me![sbfrmNotes].SetFocus
DoCmd.GoToRecord , , acNewRec
Else
'Forms![frmMain].SetFocus
Me!Screen.ActiveForm.SetFocus
Me.[FltItemNumber].Value = Null
Me.[FltDescription].Value = Null
Me.[FltPagenumber].Value = Null
Forms![frmMain]!FltItemNumber.SetFocus
'DoCmd.Echo True
End If
Exit_Handler:
Exit Sub
Err_handler:
If Err.Number <> 0 Then 'Ignore "Report cancelled" error.
MsgBox "" & Err.Number & " - " & Err.Description, , "Search"
End If
Resume Exit_Handler
End Sub
control. the tab control has 5 tabs all with there own subform. I have found
myself having to use a workaround for the fact that the subform is not
isolated (i have read allen brownes bug description and that is what im up
against)from the mainforms remove filter button docmd.showallrecords(Code
below). Basicly when i push the button i was removing the filter of the main
form. which worked fine.But now with the 5th tabs subform being set to data
entry, when i use the showallrecords or me.filter = false it is setting the
data entry subform to the first record in the table.
What i am now trying to accomplish is when the user clicks the remove
filter btn the code checks to see what the current subform is and removes the
filter without removeing focus from the subform that is curently being
viewed. I am rather new to VBA and cant seem to find the right syntax for the
code. Any and all help is greatly appretiated. Thanks Asib
Private Sub btnRemoveFilter_Click()
On Error GoTo Err_handler
'DoCmd.Echo False
DoCmd.ShowAllRecords
If Me.[sbfrmNotes].Screen.ActiveForm Then
Me![sbfrmNotes].SetFocus
DoCmd.GoToRecord , , acNewRec
Else
'Forms![frmMain].SetFocus
Me!Screen.ActiveForm.SetFocus
Me.[FltItemNumber].Value = Null
Me.[FltDescription].Value = Null
Me.[FltPagenumber].Value = Null
Forms![frmMain]!FltItemNumber.SetFocus
'DoCmd.Echo True
End If
Exit_Handler:
Exit Sub
Err_handler:
If Err.Number <> 0 Then 'Ignore "Report cancelled" error.
MsgBox "" & Err.Number & " - " & Err.Description, , "Search"
End If
Resume Exit_Handler
End Sub