Hi All,
I'm trying to generate an OR query using a user inputted comma separated list. I've replaced the comma's with Or statements, but I'm getting an error when I enter more than one value into the textbox. I'm assuming this is because the value is treated as text rather than two numbers separated by an Or.
The first box is the textbox that the user enters Project numbers into (tboxProjects). The second box is the Query (tboxQuery) generated from the user's entry using a simple Replace() call. The second textbox will be hidden once the bugs are ironed out. When the user clicks generate query three things happen.
1. Check if the box is null, if it's null give a message saying you have to enter at least one value.
2. If tboxProjects has a value, generate a query: Me.tboxQuery = Replace(Me.tboxProjects.Value, ",", " Or")
3. Run a report using tboxQuery as the input of project numbers.
If I run this with only one number, it works as expected. If I have any more than one number it fails with the following error:
I'm assuming that as the numbers are combined with Or, MS Access is converting the entire value to a string. So when the [Forms]![frmProjectID].[Form]![tboxQuery] is replaced with "25 Or 29", Access can't figure out why a string would be used to search on an integer field.
Any suggestions or work-arounds would be greatly appreciated.