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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to set the values thro' functions to the query?

Status
Not open for further replies.

tmpalaniselvam

Programmer
May 14, 2000
68
IN
Hi!
I have some set of tables in a MDB file. I want to find difference between two (time) inputs in a particular table. After that I want to put different value according to some boundries( like If above 10 hours means put as 10 and below 4 hours, put as zer0). I have written a function to set values according to time difference value.
I dont' know, how to add or use this functions from modules.
How can I use this function in queries? Pls help me.

Thanks,
Palani.
 
Lets say you have a table called [myTable] and two fields called [Time_1] and [Time_2]. The results are shown in field [Result]. Open the query wizard and select SQL view, then write:
Code:
SELECT *, (iif([Time_2]-[Time_1]>10, 10, iif ([Time_2]-[Time_1]<4, 0)) AS [Result] FROM [myTable]

Execute the query and see if it is what you expected. If it is and you want to execute this from a function in a form, just assign this query string to a variable. Then use the [tt]CreateQueryDef[/tt] instruction to make a query that you can see later. To boldly code, where no programmer has compiled before!
 
Hi!
Thanks Aristarco! I followed your way.Got success..
Thanks Again,
Palani.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top