thanks for looking at this Allen. Here is the results from running the
function from the immediate window.
?fconcatchild("T C Linc","T ID","C ID","Long",1466)
Select [C ID] From [T C Linc] Where [T ID] = 1466
2032, 1077, 955, 936, 1975, 942
Generated expected results
?fconcatchild("Build Contest Judges","T ID","C ID","Long",1466)
Select [C ID] From [Build Contest Judges] Where [T ID] = 1466
Generated error ‘Too few parameters, expected 1’
------------------------------------------------------------------------------------------
Table [T C Linc] has 2 fields; [T ID] (Twirler ID) long and [C ID] (Coach
ID) long
Query [Build Contest Judges] is a subset of [T C Linc] limited to only
judges for this contest.
I have verified that the [T ID] of 1466 exist in both the table and the
query dynaset.
If I change the query to a Make Table query and make a table exactly like
the query the function works OK and gives the expected results.
Thanks for any help.
Allen Browne said:
Post the SQL statment as printed in the Debug window.
Perhaps it contains something like [Forms].[Form1].[Text0] that works
(courtesy of the Expression Service) in a query but not in OpenRecordset.
Or perhaps you need to explicitly save the record in the form before
calling
the function to get the results you expect.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
I did exactly what you suggested and the sql pasted into a new query
gives
me
what I expected.
Capps
Meis
Stewart
That is what I got before when I captured ths sql string with a MsgBox.
The
sql string is working. I double checked the function to be sure I had
not
changed something within it and it still works on a form that uses a
table
as
a parmater to the fucntion. the forms results were correct. ???
Steve
:
The request for a parameter means there is a name in the query
statement
that Access doesn't recognise.
Add the line:
Debug.Print strSql
just above the OpenRecordset line.
When it fails, open the Immediate Window (Ctrl+G).
See if you can identify which names are wrong.
If you can't see it, create a new query, paste the SQL statement in,
and
run
the query. The parameter dialog will name the parameters it can't
find.
A few days ago Allen Browne responded to a question I posted about
how
to
concatenate fields from sequential records and he referred me to the
function
fConcatChild written by Dev Ashish. this function is great and
works
as
advertised. I have it working with a table but when i try to
substitute a
query for the M sided table I get the error "To few parameters,
expected
1"
This message seems to be coming from the line 'set rs.db =(.....'
won't this function work with queries as well as tables?
the sql string that is generated ( I captured it via a MsgBox) works
when
pasted into a query and executed as SQL . It gives me expected
record
set
just not in the format I need ie concatenated.