Solved Alert Counter on Form (1 Viewer)

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
Hi. I hope someone can help.
I have a main form that has a list of occupancies. In and Out. I'm trying to get a counter alert on the main form to display Maximun if the manually set maximum is reached based on the total of entries minus outs in one day. I'm not sure where to do this, on the form or in a query.

I've attached a sample db.
Thank you ahead of time.
 

Attachments

  • DatabaseXX.accdb
    608 KB · Views: 67

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:17
Joined
May 7, 2009
Messages
19,245
see your form in design view.
 

Attachments

  • DatabaseXX.accdb
    608 KB · Views: 58

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
I've made a mistake. The count is continuous.
Example, 100 IN at 9am then another 100 IN at 10am, then another 100 IN at 11am.. then 100 OUT at 12pm .... such as the sum would be 200 minus the 100 amount of outs.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:17
Joined
May 7, 2009
Messages
19,245
see the form again.
 

Attachments

  • DatabaseXX.accdb
    608 KB · Views: 57

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:17
Joined
May 7, 2009
Messages
19,245
... and another
 

Attachments

  • DatabaseXX.accdb
    672 KB · Views: 65

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
It works great.
Now that I look at it, one change. LOW MEDIUM AND HIGH.
I've added some calculation fields to the form. I needed to see the actual numbers.
Instead of just Maximum and Good, how can I add the MEDIUM where the Count is Less then 5 before the Max Amount?
 

Attachments

  • DatabaseXX2.accdb
    768 KB · Views: 73

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
I don't know the syntax but I understand the logic. I'm trying to use the below.

=IIf(DLookUp("GMAXSET","GUEST_MAX_SET")<=Nz(DSum("GCOUNT","GUEST_T","GDATE=DATE() AND INOUT='IN'"),0)-Nz(DSum("GCOUNT","GUEST_T","GDATE=DATE() AND INOUT='OUT'"),0)-Dat()-5,"MID",IIf(DLookUp("GMAXSET","GUEST_MAX_SET")<=Nz(DSum("GCOUNT","GUEST_T","GDATE=DATE() AND INOUT='IN'"),0)-Nz(DSum("GCOUNT","GUEST_T","GDATE=DATE() AND INOUT='OUT'"),0),"MAX","LOW"))
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:17
Joined
May 7, 2009
Messages
19,245
i made a query QRY_TOTAL_TODAY.
see your form now.
 

Attachments

  • DatabaseXX2.accdb
    900 KB · Views: 70

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
i made a query QRY_TOTAL_TODAY.
see your form now.
I uploaded another one. If you look at the totals in red. Those are the totals. Each time a count is done, new customers are entering. The entries is in addition to how ever many customers that are existing in the restaurant. so if the entry is 10 at 8am and 10 at 9am then there should be 20 total.
the do.cmd to open the Guest set max didn't work for me so I placed a macro in it's place. I understand what you did for the evaluation part but I don't know how to complete the syntax and formula to tally the combined totals where it's only for IN or OUT.
 

Attachments

  • DatabaseXX3.accdb
    900 KB · Views: 68
Last edited:

ebs17

Well-known member
Local time
Today, 17:17
Joined
Feb 7, 2020
Messages
1,946
I think one could solve this with a single query as the RecordSource for the form:
SQL:
SELECT
   G.GDate,
   G.GTime,
   G.INOUT,
   G.GCount,
   DSum("GCount * IIF(INOUT = 'OUT', -1, 1)", "GUEST_T", "GDate = Date() AND GTime <= " & Format(G.GTime, "\#hh:nn:ss\#")) AS CurrentTotal,
   DLookup("GMAXSET", "GUEST_MAX_SET") - CurrentTotal AS FreeSpace
FROM
   GUEST_T AS G
WHERE
   G.GDate = Date()
ORDER BY
   G.GTime
If necessary, you could derive your alerts from concrete values from FreeSpace or work with colors using conditional formatting in the form.
 
Last edited:

Jomat

Member
Local time
Today, 08:17
Joined
Mar 22, 2023
Messages
35
Thank you all.
I've decided to use unbound fields for the calculation and the conditioning formating. Works now.
Thank you all again.
 

Users who are viewing this thread

Top Bottom