473,225 Members | 1,300 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,225 software developers and data experts.

Calculated Form Field, with Criteria?

4 2Bits
Hi all, I have a form with a few Listboxes on it that acts as my Main Menu if you will.

I created separate queries for each list box with one field to count all the records in that list box.

Works great until one of the Listboxes is empty, then the form goes blank.

Can I create a calculated field on my form that has criteria - IE: like I have in my qrys.

Below is the source code of my Main Menu form, which includes the individual queries I made. (I couldn't attach an image)

I would like to have a field that counts each section, "In Bound", "Out Bound", etc.

Thanks in advance!
Scott
Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.    Count(tblArrivals.Status) AS CountOfStatus
  3. FROM 
  4.    STATUS 
  5.        INNER JOIN tblArrivals ON STATUS.STATUS = tblArrivals.Status
  6. WHERE 
  7.     (
  8.       ((STATUS.STATUS) Like "Arriving within 24 Hours") 
  9.         AND 
  10.       ((tblArrivals.VSLTYPE) Not Like "Y/M")
  11.     );
Apr 29 '22 #1
1 11118
zmbd
5,501 Expert Mod 4TB
[BLUF]
So, I've read this question about a dozen times now and I'm not entirely sure what you are after - I don't think you need a calculated field for what you want - but it's hard to decern for certain from your post.

However, a fatal character flaw is that I dislike is not offering some possible answer - feels a bit dismissive and I never liked that when I asked for help
(sort of like when people say to RTFM or similar non-solution-answers - 👾🔺)

Using a generic database, attached, I've made a few aggregate queries that group on and count within tbl_people - see if this is what you are after... I'm fairly certain that it is...

Details:
+ qry_count_mf is based on a criteria within tbl_people

+ I also created a tbl_CrossReference that creates a many(to)many (M:M)(*) relationship between tbl_people and tbl_wordlist so as to have the innerjoin
++ qry_count_CrossRefInnerJoinWord
++ __qry_GUI_CrossReference is a more human readable form for tbl_CrossReference.
+++
One thing that strikes me is ((STATUS.STATUS) Like "Arriving within 24 Hours")
Ideally you would not be using a text string like this, better to use a normalized approach - this is what I am trying to show you with the tbl_CrossReference (*)

(*)-- now you could have something MUCH simpler such as the foreign key directly in tbl_people that relates back to tbl_wordlist (creating a 1:M relationship) instead of tbl_CrossReference
One advantage of using the related table (and the whole point of a relational database) is say I want to change the spelling of the word "color" from the American spelling to "colour" which is more common in other countries - I only need find that entry in the related table, change the spelling there - the primary key will not change; hence, I do not need to go back into potentially dozens (or thousands) of lines of SQL nor VBA to change a hard coded value "color" to "colour" as these would utilize the primary key

IF possible try posting your screen shot again
If you click on [Edit] for your original post it should default to the advanced editor and there is an [Upload Files] button
- when posting within a thread click on [advanced] in the advanced editor you can upload the image
- if you're still having issues uploading the image file please PM/DM me and we'll go from there
Attached Files
File Type: zip Bytesthread_977258.zip (100.1 KB, 34 views)
Apr 30 '22 #2

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

Similar topics

1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
8
by: MS | last post by:
Hello, I have a form with a LoanRequired field which accepts numeric data only. If user enters >14900 then I want the user to continue as normal with the default form. If user enters <1000 then...
3
by: MX1 | last post by:
I have a query written in MS Access that has a few calculated fields. Is it possible to refer to that query in a form field. I'd like the form field to show the sum of one of the columns from the...
1
by: Norbert Lieckfeldt | last post by:
MS Access 2002 here. I am just trying to set up a simple database for a friend who's an optician. Basically, all clients with address details, date of last eyetest and a drop-down combo box to...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
3
by: dhowell | last post by:
I have a form that has two sub forms. I would like to use the current value of one of the subform fields as a search parameter in a query. I tried pointing to the name of the form/field within...
3
by: Chris | last post by:
Before I started to create table, etc to track unique form field record number assigments I thought I'd check to see if there is now a better way to do this in .NET. I have a parent form (table)...
11
Dököll
by: Dököll | last post by:
Hello Hello! Hope it's a good week-end near you... I am trying to substract then divide through a form field to no avail. What do you make of it? (1) Achieved form grabs a certain number...
0
by: Tara Small | last post by:
I am tring to create a form in which a expiration date and pre-expiration reminder dates are calculated from a user defined certification date. I then want this calculated expiration field to show...
2
by: Daryl Austin | last post by:
I am new to Access and need some help with creating calculated fields. I am trying to create a calculated sum field in a form, the sumfield would add the values of 5 fields in a table (all 5 fields...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.