Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Help Im stuck
Redina Hibbs 

2 years ago
I am attempting to create a database to track lab results for raw milk delivery trucks. I have gotten most of the database complete including the navagation page but I'm stuck on the final step before the report. After the results are entered I need to be able to pull up (popup would be great) the previous results for each truck to be able to flag the load appropriately. Is there a way to do this while in the entry form?
Thanks!
Kevin Robertson  @Reply  
          
2 years ago
I would show previous deliveries in a Subform sorted descending by date or you could get the previous delivery using the DMax function based on the date of the delivery.

We would need to know more about your database (including screenshots) to give you more detailed advice.
Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago
The 1st screenshot is of my main table. It contains everything. The load # is from the table Loads. The 2ns screenshot is of my final report after all results have been entered. It displays the load #'s, results, and if the load has been flagged for being too high and which flag it is (1st, 2nd, 3rd). The 3rd screenshot is the entry form for the final results. This is where I need to figure out how to show the previous flag to know what to assign. Example the result that is 186 is this trucker's 1st flag, the result 194 is that trucker's 3rd flag and has been automictically suspended until cleared by management. How this helps!
Willem Els  @Reply  
   
2 years ago
On each load you will need a truck number or a unique way to identify it, then you can use it to filter the data in a query by this Identifier and sort by date.
Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago
I shall see if the dmax function will work. Thanks!
Redina Hibbs OP  @Reply  

2 years ago
How would I implement the DMAX option for each line of my PI-Results Filter?
Sami Shamma  @Reply  
             
2 years ago
If you have not yet watched this video, please do so.
DMax
There are three parts to Dmax:
1)What Data are you retrieving (Last result)
2) Where you are retrieving it from (The table)
3) The WHERE condition (Which records to check)
Kevin Robertson  @Reply  
          
2 years ago
You could build a Query with a Calculated Field that implements the DMax function then base your Continuous Form off of that Query to show the results you want to see.
Redina Hibbs OP  @Reply  

2 years ago
Kevin, how would I do that? I tried to do a new form based on a new query that filtered the loads that were above the threshold and then do the dmax like he shows in the video but it just gave me an error message.
Redina Hibbs OP  @Reply  

2 years ago
=DMax("Flagged Loads","Load Log","Previous Flag"="& Flagged_Date)
Kevin Robertson  @Reply  
          
2 years ago
Remember: Dates should be enclosed in #.

=DMax("Flagged Loads","Load Log","Previous Flag"=#"& [Flagged Date] & "#")

Advice: It is advised not to uses spaces or special characters in field or object names.
If spaces are used make sure to enclose the field name in square brackets.
Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago
=DMax("[Flagged Loads]","[Load Log]","PreviousFlag=" & [Date])

I'm trying a different approach. I created a new form based on a new query that filtered the high loads for that date and then added the Dmax for Previous Flag. But it keeps giving me a #Error message. It should be showing me 2nd since this particular load is currently on its 3rd and has been suspended. New code above.
Kevin Robertson  @Reply  
          
2 years ago
Sorry. I didn't notice the extra double quote after Previous Flag.

=DMax("[Flagged Loads]","[Load Log]","[Previous Flag]=#" & [Flagged Date] & "#")
Kevin Robertson  @Reply  
          
2 years ago
Have you name one of your fields Date? This is a reserved word (it is the name of a function that returns the current date) and will cause you many problems in the future. I advise renaming the field. As an example: OrderDate
Kevin Robertson  @Reply  
          
2 years ago
Additional advice: I recommend working your way through Richard's classes. You appear to be missing basic knowledge of proper database concepts.
Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago
I got the #Error to disappear but I'm still not getting the previous flag. :(
Here is the code so far:
=DMax("[Flagged Loads]","[Load Log]","PreviousFlag=" & [Load #])
Redina Hibbs OP  @Reply  

2 years ago
It has been about 10 years since I took Access in college. I remember some things but I have been working through the classes to refresh my memory. I don't remember using DMax in my college course so it is rather new to me.
Richard Rost  @Reply  
          
2 years ago
If you can, rename your fields in your table. Get rid of spaces and non-alphanumeric characters from your table and field names. They're going to cause you pain in the future - if not already.

What type of value is that Load# field? From the tiny bit I can see of one, it looks like a text value and it looks like you might even be using a Lookup Field (another big no-no). If it's text, you need to enclose it in quotes inside the DMax.

=DMax("[Flagged Loads]","[Load Log]","PreviousFlag=""" & [Load #] & """")

If it's a lookup field, you're SOL.

And yes, I would strongly recommend you watch the Beginner and Expert classes - as many as you can. I cover a lot of fundamentals on how to construct your database... like not using spaces, string concatenation, and things like that. Remember, if you build a house on sand, it doesn't matter how pretty that house is... if the foundation is weak, you're going to have issues.
Redina Hibbs OP  @Reply  

2 years ago

Redina Hibbs OP  @Reply  

2 years ago
Thank you for all of your help! I was able to remember how to insert a table based on a query into my FlaggedLoads_F, which you can see in the screenshot. And I had totally forgotten about the no space rule until you mentioned it in one of your videos. I've been slowly working my way through them. The Load_# (See! No space! :) ) is based on a lookup from the Loads table. I have 100+ trucks to track and it seemed the best way to do that when I started this project. It was suppose to be a simple database for me to track results but my QA manager asked me to make it user friendly for the other techs in my lab.
Redina Hibbs OP  @Reply  

2 years ago
I hate to ask anymore of you guys, but my manager has asked me if it would be possible to add the load # into the email subject line when we email the reports. Is this possible? I know that there is probably some sort of VB code but I'm not proficient in VB. I've been using Macro Design to have the email generate with a click of a button. I then have it set up to allow editing so that I can add the load # manually. Thank you for all of the help you have already given, and for any additional help you can provide.
Redina Hibbs OP  @Reply  

2 years ago

Kevin Robertson  @Reply  
          
2 years ago
Start the subject line with an equals sign, enclose any static text in double quotes and concatenate your field value.

Example:
    ="Your Text Here " & [Forms]![YourFormName]![YourFieldName]

Concatenation
Value From a Form

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 4:32:39 AM. PLT: 0s