Syntax issue in query with text form value variable
Posted on 2011-10-13
I have a query that is based on a form. The field on the form is called Combo1 and is a combo box. This combo box is populated with the following: FileNum: Left([tblFiles]![FileNumber],5), so only the first five digits of the FileNumber field are showing up. I need to grab all file numbers with the same prefix, no matter what the rest of the file number is. That's why I'm using the LEFT function.
I then need to print a report based on a filtered query, showing only the file numbers that have the prefix selected in the combo box. Normally, I would do something like this in the query: WHERE (((tblFiles.fileNumber)=[forms]![frmEnterPrefix]![Combo1]) AND ((tblFiles.inactive)="N")) but it's not working because (I suspect) I'm only grabbing the first five digits of the file number, and not the file number in its entirety.
Can I use LIKE instead of = in the query? Also, FileNumber is a text field, not a numeric field. I'm just not sure of the syntax.