Hi there,
I pulling my hair out with a SQL statement I am using for a query in Access.
I have a list box which pulls data from my table. I am using the list box to allow the user to select a record which will then be pulled up in detail in the main form. I have a search text box which refines the records. However I want to also use a combo box to sort the records too. See my statement below.
In ORDER BY, if I manually type a field, it sorts fine. But when I try and insert the combo box [sort] value from the form, nothing happens...
--------
SELECT tblMain.ID, tblMain.Type, tblMain.Site, tblMain.Room, tblMain.Area, *
FROM tblMain
WHERE (((tblMain.Type) Like "*" & Forms!frmMain!Search2 & "*")) Or (((tblMain.Site) Like "*" & Forms!frmMain!Search2 & "*")) Or (((tblMain.Room) Like "*" & Forms!frmMain!Search2 & "*")) Or (((tblMain.Area) Like "*" & Forms!frmMain!Search2 & "*"))
ORDER BY '& [Forms]![frmMain]![sort] &';
--------
Any help would be appreciated