I have a sub routine that add news records to an AssignedBatches table based on criteria in a function. The function returns a variable length array of batch numbers that are to used in assigning batches. I've got this part working well. Now I need to show the user the added records. My understanding is that Access SQL does not allow variables in teh criteria, but does accept functions.
I have the batch numbers stored in a Public Function called GetBatchNumbers() within the current form. I created a query detailing all the fields the user needs to see with the criteria: Where MasterBatch.BatchNum = GetBatchNumbers()
In a sub routine within the current form, I am opening the query using:
docmd.OpenQuery "qryAssignedBatches", acviewnormal, acReadonly
I am getting a runtime error (3085): undefined function 'GetBatchNumbers' in
expression.
I don't think it's the SQL syntax that's causing the error. Is my
problem that I am opening the query from within a subroutine & it can't see
the function data? Or do I need to have the function in it's own module for
this work?
Perhaps a temporary table to store the batch numbers is the way to go?
I could use some help!
Thanks,
AA
I have the batch numbers stored in a Public Function called GetBatchNumbers() within the current form. I created a query detailing all the fields the user needs to see with the criteria: Where MasterBatch.BatchNum = GetBatchNumbers()
In a sub routine within the current form, I am opening the query using:
docmd.OpenQuery "qryAssignedBatches", acviewnormal, acReadonly
I am getting a runtime error (3085): undefined function 'GetBatchNumbers' in
expression.
I don't think it's the SQL syntax that's causing the error. Is my
problem that I am opening the query from within a subroutine & it can't see
the function data? Or do I need to have the function in it's own module for
this work?
Perhaps a temporary table to store the batch numbers is the way to go?
I could use some help!
Thanks,
AA