C
Christine
Hi,
I am trying to use parametrized UDFs in a form's RecordSource. My
problem: I want the user to be prompted for parameter input.
Background: I have a bunch of UDFs - some parametrized, some not -
that can be selected by the user in an Access form. When selected, the
UDF is used as a filter against the existing RecordSource of a second
form. That's just a simple line of VBA (strSQL being the original
RecordSource of the form):
MyForm.RecordSource = strSQL & " WHERE Id In (SELECT Id FROM " & MyUDF
& ")"
This works for non-parametrized UDFs. My problem with parametrized
UDFs is:
- I don't know whether the selected UDF accepts parameters or not
- I don't know how many parameters are accepted or what their names
are
- I need the user to be prompted for parameters, if necessary
Prompting the user for parameters doesn't work with the code above, of
course. It works fine when opening the UDF by using
DoCmd.OpenFunction, but: this returns the UDF's results in a table
view - and I need to re-use these results in order to change my form's
record source. Can anyone give me a hint on how to do this?
I am trying to use parametrized UDFs in a form's RecordSource. My
problem: I want the user to be prompted for parameter input.
Background: I have a bunch of UDFs - some parametrized, some not -
that can be selected by the user in an Access form. When selected, the
UDF is used as a filter against the existing RecordSource of a second
form. That's just a simple line of VBA (strSQL being the original
RecordSource of the form):
MyForm.RecordSource = strSQL & " WHERE Id In (SELECT Id FROM " & MyUDF
& ")"
This works for non-parametrized UDFs. My problem with parametrized
UDFs is:
- I don't know whether the selected UDF accepts parameters or not
- I don't know how many parameters are accepted or what their names
are
- I need the user to be prompted for parameters, if necessary
Prompting the user for parameters doesn't work with the code above, of
course. It works fine when opening the UDF by using
DoCmd.OpenFunction, but: this returns the UDF's results in a table
view - and I need to re-use these results in order to change my form's
record source. Can anyone give me a hint on how to do this?