473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

open different forms based on the results of a count query

lwwhite
16
When a user clicks OK on form "SelectDefaults," I want to open form "Welcome" if the results of query "qry_todo_overdue" = 0 or form "OverdueToDo" if the results >= 1. First, I assume that I need to run the query in "SelectDefault's" OnOpen event, right? But having done that, I'm not sure how to incorporate the query-checking into an If...Then statement on the OK button's OnClick event.

Here is the query's SQL:

SELECT Count(*) AS Expr1
FROM tbl_tasklist
WHERE (((tbl_tasklist.ptsk_duedate)<Date()) AND ((tbl_tasklist.ptsk_assigned)=[Forms]![SelectDefaults]![User]));

On a related note, and you may prefer this to be a separate thread, I want to show or hide a button on a form ("iScope") based on the results of a query ("qry_todos_for_issue"). Here is that SQL:

SELECT Count(*) AS Expr1
FROM tbl_tasklist
WHERE (((tbl_tasklist.ptsk_issue)=[Forms]![iScope]![issue]));

Again, I assume the first step is to run "qry_todos_for_issue" in "iScope's" OnOpen event. I guess I also need to run it in the OnCurrent event for when users open a different record while the form is still open? And then, I also don't know how to incorporate the query-checking into the button's code to determine the Visible property.

If there is an altogether better way to accomplish either of these things other than with a query, I would love to know. Any help is much appreciated, as always!

Leigh
Apr 27 '07 #1
1 1784
Rabbit
12,516 Expert Mod 8TB
You can retrieve the count in many ways. The easiest is to just use DLookup to get the value.
Expand|Select|Wrap|Line Numbers
  1. If DLookup("Expr1", "QueryName") = 0 Then
  2.      ...
  3. Else
  4.      ...
  5. End If
Apr 27 '07 #2

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

Similar topics

1
by: Rich | last post by:
Hello, I've been trying to teach myself JavaScript via a book and a number of JavaScript Tutorials Online. I have more understanding of what I am doing, although definetly not has much as what I...
55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
1
by: Rado | last post by:
Hi All, This might quite simple process for some but I am finding it really difficult to do. What is required is not a standard Duplicate query but a variation on it. For example I have...
4
by: Koen | last post by:
Hi all, At work I created a database which is really helpful. The database is used by approx 15 users. Everything worked great, until I added some 'scoreboard' forms and reports. I get the...
46
by: Steve | last post by:
Access97 Database The database is split into a frontend and backend and not connected to any other database. The database has an unbound report with 15 subreports. Some of the subreports include...
15
by: Dave | last post by:
Has anyone encountered the error message "Can not open any more databases" and what did you do to solve it? Thanks, Dave
6
by: Keith Smith | last post by:
I read in a Visual Studio .NET book that with C# it is now recommended to open database connections whenever you need to query a database as opposed to the traditional method of opening a database...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
3
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.