J
JohnW
Hi, I hope you have done this before.
I have one table, tblAllStockAlignedColumns, (32,000 records).
On a continuous form I use combo boxes in the form header linked back to
fields in the table to run a SQL filter using DAO. This works fine.
What I would like to do is set the combo boxes to drop down only records
from the resulting recordset, and then, drill down further within that
resulting recordset by using the after update of the combo to restrict the
number of records further. Here is the code I use, any help appreciated:-
Private Sub ComboReference_AfterUpdate()
Dim dbs As Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLWhere As String
Dim frm As Access.Form
strSQL = "SELECT * FROM tblAllStockAlignedColumns"
strSQL = strSQL & " WHERE Reference LIKE'" & ComboReference & "*'" &
" AND"
strSQL = strSQL & " tblAllStockAlignedColumns.Deleted = No ORDER BY
Reference;"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
DoCmd.OpenForm "frmAllStockAlignedColumns"
Set frm = Forms![frmAllStockAlignedColumns]
Set frm.Recordset = rst
Me.ComboReference.Value = Null
Me.ComboReference.SetFocus
End Sub
Thanks,
John
I have one table, tblAllStockAlignedColumns, (32,000 records).
On a continuous form I use combo boxes in the form header linked back to
fields in the table to run a SQL filter using DAO. This works fine.
What I would like to do is set the combo boxes to drop down only records
from the resulting recordset, and then, drill down further within that
resulting recordset by using the after update of the combo to restrict the
number of records further. Here is the code I use, any help appreciated:-
Private Sub ComboReference_AfterUpdate()
Dim dbs As Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLWhere As String
Dim frm As Access.Form
strSQL = "SELECT * FROM tblAllStockAlignedColumns"
strSQL = strSQL & " WHERE Reference LIKE'" & ComboReference & "*'" &
" AND"
strSQL = strSQL & " tblAllStockAlignedColumns.Deleted = No ORDER BY
Reference;"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
DoCmd.OpenForm "frmAllStockAlignedColumns"
Set frm = Forms![frmAllStockAlignedColumns]
Set frm.Recordset = rst
Me.ComboReference.Value = Null
Me.ComboReference.SetFocus
End Sub
Thanks,
John