G
Guest
I want to return the count of related records between 2 files without using a
saved query. ie I want to do it all in the code.
For example if I make an Update Query in the Query grid and dont save the
query but just take the SQL code and put it in the form code I will use:
DoCmd.RunSQL "UPDATE .............;" on an event in the form.
I want to do this ; but to count the records of the related files.
I tried taking the SQL code from a count query and do DoCmd.RunSQL like the
UPDATE above as:
DoCmd.RunSQL "SELECT Count(BatchInvoice.InvNum) AS CountOfInvNum
FROM tableInvoices INNER JOIN BatchInvoice ON (tableInvoices.InvNum =
BatchInvoice.InvNum);"
But this does not work.
I cant use DCount(Expression,Domain,Criteria) because the Domain would have
to be a table or a saved query, right?
How do you do this count in the code without using a saved query?
Thank you very much for your help.
Steven
saved query. ie I want to do it all in the code.
For example if I make an Update Query in the Query grid and dont save the
query but just take the SQL code and put it in the form code I will use:
DoCmd.RunSQL "UPDATE .............;" on an event in the form.
I want to do this ; but to count the records of the related files.
I tried taking the SQL code from a count query and do DoCmd.RunSQL like the
UPDATE above as:
DoCmd.RunSQL "SELECT Count(BatchInvoice.InvNum) AS CountOfInvNum
FROM tableInvoices INNER JOIN BatchInvoice ON (tableInvoices.InvNum =
BatchInvoice.InvNum);"
But this does not work.
I cant use DCount(Expression,Domain,Criteria) because the Domain would have
to be a table or a saved query, right?
How do you do this count in the code without using a saved query?
Thank you very much for your help.
Steven