Even so, why would that cause that to use the Company select statement?
Because that's the last (and first) time that
Code:
Me.Search_subform.Form.RecordSource =
was correctly created. myCompany is correctly defined as string.
You have defined myBranch as an integer. It cannot equal the string "Select * from [Main Table] where ([Branch] = " & Me.cboBranch & ") without being in error. Same for myEnteredBy.
As stated in post #2, neither can be defined as an integer and set to a string value. That's error 13, type mismatch.
Perhaps you expect myBranch to be equal to the results of the select statement. It will not. It will contain the select statement itself.
Code:
Dim myCompany As String
myCompany = "Select * from [Main Table] where [Company Name] = '" & Me.cboCompany & "'"
Me.Search_subform.Form.RecordSource = myCompany
is the same as
Me.Search_subform.Form.RecordSource = "Select * from [Main Table] where [Company Name] = '" & Me.cboCompany & "'"