473,466 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Query Cond - Numberic Vs. Text

5 New Member
Hello,

Please help me to solve this.

I have a query which calculates sum of pages.

Total Pages: Sum([TASK ID 37])

I have a option button in my FORM wich has two conditions
a) > 11 pages - option button 1
b) <=11 pages - option button 2

in my query i want to display condition 1 if option 1 is selected and vice versa.

below is the query i am trying.

SELECT Query_Tbl_Audit_Data_Filter.EmployeeID AS [Oper #], Sum(nz([TASK ID 37])) AS [Total Pages]
FROM Query_Tbl_Audit_Data_Filter
GROUP BY Query_Tbl_Audit_Data_Filter.EmployeeID
HAVING (((Sum(nz([TASK ID 37])))=IIf([Forms]![Home]![SuffCond]=1,(Sum(nz([TASK ID 37])))>11,(Sum(nz([TASK ID 37])))<=11)));

Regards,
Karthikeyan S
Sep 20 '08 #1
1 1172
DonRayner
489 Recognized Expert Contributor
Use the setting of your option button to set a global variable. Use that variable in a function to set the value of the function and then use the function as the condition in your query.

EG:
The module for your form would contain
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub MyOptionButton_Change()
  5. On error GoTo ErrPoint
  6.  
  7.     If Me.MyOption.value = True then
  8.         MyPublicVar = True
  9.     Else
  10.        MyPublicVar = False
  11.     End If
  12.  
  13. ExitPoint:
  14.     Exit Sub
  15. ErrPoint:
  16.     ' Error traping code goes here
  17.     Resume ExitPoint
  18. End Sub
  19.  

Then Create a module MyModule
It would look like this

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Public MyVar
  5.  
  6. Public Function MyFunction() as string
  7.     MyFunction = MyVar
  8. End Function
Finally add the MyFunction() as the criteria in your query.....
Hope this helps
Sep 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Christoph | last post by:
The query that I'm trying to execute is as follows: SELECT card_names.card_name, card_sets.set_name FROM card_names_in_sets, card_names, card_sets WHERE
7
by: Egor Shipovalov | last post by:
I'm implementing paging through search results using cursors. Is there a better way to know total number of rows under a cursor than running a separate COUNT(*) query? I think PostgreSQL is bound...
6
by: Steven D.Arnold | last post by:
I have a query which does not use column indexes that it should use. I have discovered some interesting behaviors of Postgres which may indicate a bug in the database's query planning. Take a...
8
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run...
21
by: CSN | last post by:
I have a pretty simple select query that joins a table (p) with 125K rows with another table (pc) with almost one million rows: select p.* from product_categories pc inner join products p on...
1
by: Paolo Tavalazzi | last post by:
I have 2 query that differ only for order by clause. The time of execution of the two query is a lot of different. 1) explain analyze select ...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
1
by: Chris Smith | last post by:
I've just noticed in the regular profiling information from our web application that a particular query on a fairly small database is taking about 15 seconds. The query is generated from software...
8
by: Cott Lang | last post by:
I have come up with a simple query that runs horribly depending on the number of columns selected. select order_lines.* from orders, order_lines where orders.merchant_order_id = '11343445' and...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.