I'm trying to create a tool for co-workers in my department to append data into a local Access database from an AS400 system. I'm trying to make this as user-friendly as possible for end users that won't be familiar or comfortable with adjusting the query SQL.
I have a passthrough query I've already written, but my problem is that I have an In() expression in the query that can vary depending on what the user criteria is. I've already tried to work around this by attempting to create an inner join between my local table (tbl_insco_criteria) and the AS400 file I'm querying, but this hasn't worked. Using a Select query linked to this Passthrough query to do this same action works, but takes considerably more time to generate due to the number of records involved, thus my attempt to find a way to calculate an updated In() expression.
I already have a VBA function that can perform a Find/Replace action to update the character string that needs to be updated, however, I'm having difficulty in writing a function that will calculate an updated In() expression from records entered into a table that can vary in the number of records entered, that can then be passed to my passthrough query using the Find/Replace function.
The table name is tbl_insco_criteria with a single column name of INSCO that is in Long Integer number format. An example of a string that might be generated is IN('305','306','380','800','801'). I would be placing the expression calculation into a form that would then be referenced by the Find/Replace function when that action is performed.
I have found an example that is sort of in the same vein as what I'm trying to accomplish here :http://www.databasedev.co.uk/query_using_listbox.html. However, my goal is for to users enter in the values into the tbl_insco_criteria table (as there would be no standard list of values that I can feed to a listbox, since the values in the AS400 dictionary files can vary from one AS400 to another), and then the VBA would calculate the In() expression SQL string in a form field on the database switchboard that would include all records in the INSCO field in the table. This SQL string would then be inserted into the passthrough query via the Find/Replace function (that I already have working) prior to running the query.
Any assistance would be appreciated.