Code:
Private Sub cboSearch_Change()
On Error GoTo Err_cboSearch_Change
Dim db As Database
Dim rst As DAO.Recordset
Dim SQL As String
SQL = "SELECT tblAuctions.AucID, tblAuctions.DateListed, tblAuctions.DateClosed, tblAuctions.Qty, tblAuctions.Bid_Price, tblAuctions.BO_Price, tblAuctions.Duration, tblAuctions.Deposit, tblAuctions.AH_Cut, tblAuctions.Status, tblAuctions.Notes, tblItems.Item, tblItems.Level, tblItems.Type, tblItems.Composition, tblItems.Dep48, tblItems.Dep24, tblItems.Dep12, tblItems.InStock "
SQL = SQL & "FROM (tblItems INNER JOIN tblAuctions ON tblItems.ItemID = tblAuctions.ItemIDLookup) "
SQL = SQL & "WHERE tblItems.ItemID=" & Me.cboSearch.Column(0) & " and left(tblAuctions.Status,1)='L';"
Set db = CurrentDb
Set rst = db.OpenRecordset(SQL)
With Me
.sfMarkSold.Form.RecordSource = SQL
I have tested the SQL produced by pausing the code and copying the generated SQL and making a new query. That works fine. Also does it work when you manually input the same SQL statement into the recordsource for the form that is used for the subform. That also displays properly. It is only when I programmatically change the subform control's recordsource that the display fails. What am I doing wrong?