Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

Function call as a query attibute...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NWO - 04 Feb 2006 13:07 GMT
I have a situation where a query attribute is a function call that takes two
parameters.  When I add criteria, Access treats the attribute as a parameter
query before calling the function.  How do I call the function without the
atrtributes being treated as a parameter query.

Your assistance is appreciated.

NWO :)
Allen Browne - 05 Feb 2006 04:53 GMT
From your description, it sounds like you have a calculated query field that
looks something like this in query design view:
   Expr1: MyFunc([Arg1], [Arg2])

It sounds like that works without asking for parameter boxes, so I assume
that Arg1 and Arg2 are other fields in the query. But when you type
something in the Criteria row under this calculataed field, Access suddenly
starts asking for Arg1 and Arg2.

That leaves me wondering if Arg1 and Arg2 are themselves calcuated fields.
If so, you have a logical problem: Access must complete the calculations
before it can determine which records to select, but it may not be able to
perform the calculations until it knows which records are selected.

If that sounds like what you are experiencing, you might be able to solve
the problem by replacing Arg1 and Arg2 with the full expressions of those
fields instead of the alias names. For example, if the Arg1 field is:
   Arg1: [Quantity] * [PriceEach]
then you might get away with:
   Expr1: MyFunc([Quantity] * [PriceEach], ...

That will not work if Arg1 and Arg2 involve any aggregation. It that
applies, you probably need to create another query, using the existing one
as your input table. Remove the criteria from the calculated field in the
first query, and place it in the 2nd one instead.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a situation where a query attribute is a function call that takes
>two
[quoted text clipped - 6 lines]
>
> NWO :)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.