Several command buttons on my switchboard open a search form. (The OnLoad event of the search form runs a filter with the matching product results displayed on a subform.) Depending on which switchboard button is selected, I want each one to set a different BackColor of the search form as it opens. A sample of the OnClick code I am currently using on one of the buttons is below. I get "Application-defined or Object-defined error" and the color does not change. I appreciate any help.
Private Sub cmdRed_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSearch"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!frmSearch!cboProductType = "Saber"
Forms!frmSearch.BackColor = 255
End Sub
Private Sub cmdRed_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSearch"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!frmSearch!cboProductType = "Saber"
Forms!frmSearch.BackColor = 255
End Sub