Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Query recognize my module 1

Status
Not open for further replies.

TTThio

Programmer
May 3, 2001
185
US
Hi folks,

I'm building a public function in module section.
I need to use it to create query. But my query doesn't recognize that function. How to make it work?

Thanks.
 
Are you assigning the value of your function to something in the query?

For example if your function was 'getcost':

Field: |qty |price |Cost: getcost(qty,price)
Table: |Orders|Orders|


Can you post the error message that you are getting? Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Mike,

thanks for the reply. I just found out that the query didn't return anything because I forgot to assign the return value to the function itself......

However, I do now face another problem,
How to get the most recent month value, exp. if my records show March-June, I just need to have June records. So, the records need to be displayed as per the last month.

Thanks again.
 
Create a new field in your query.......

Field: OrderMonth: month(orderdate)
Criteria: month(date())


This will limit the results to the current month Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Thanks Mike. It might work.
However,
how if the data is pulled on June for period of (April, May, June), where in June, there's no order. The last one is still May.

 
I'm not sure I understand your problem. If you run the query in June, you should only get June records. Isn't that what you want? Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Sorry about that Mike.
I'm running the query a month after the last period because I'm making a statement based on the past months.
Well, your idea is working though. Because actually what I need will be substracting it with 1, right....
Once again, my neglectance.

Thanks a lot for the idea. It does help!! I vote one for you above....

 
Right, if you subtract one from the month(date()), that will give you last months totals. If you want all data except the current month, you could use <> month(date()) for the criteria.

Sounds like your on the right track....

Thanks for the vote. Mike Rohde
rohdem@marshallengines.com
&quot;If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top