Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Track Log On    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Invalid Use of Null
Rusty Abernathy 
     
2 years ago
I am trying to incorporate the Tracking Logon/Log off into a school routine I am working on. I keep getting invalid use of null when anyone has the main menu open. If I close all main menus, the two query's work perfectly. If I remove the sort on the LogOnTime:TimeStamp in Query1 and leave the "Is Not Null" in LogOffTime: CDate(DMin("TimeStamp","LogT","(Event = ""Log Off"" or Event = ""Log On"") AND TimeStamp > #" & [TimeStamp] & "# AND Username = """ & [Username] & """")) Query 1 will work with the main menu loaded and the result matches logon/logoff just like it is supposed to. However, Query 2 still gets the "Invalid Use of Null" and I am sending query 1 as the source of Query 2.

Before I post all code can you confirm that Query 1 and Query 2 will work with a log on and no corresponding Log off. - Basically, asking if the queries should work with current log Ons.
Rusty Abernathy OP  @Reply  
     
2 years ago
I let AI produce code for this routine, and it works perfectly. I get, and wanted, a blank Log Off field for those currently logged on and I do not get any Invalid Use of Null errors. I would have never been able to come up with this solution, but AI did. The aggerate query works also. Both queries work regardless of if a user is currently logged in or not. Here are the entries for LogOffTime and Total minutes:

LogOffTime: (SELECT TOP 1 TimeStamp FROM LogT AS L2 WHERE L2.Username = LogT.Username AND L2.TimeStamp > LogT.TimeStamp ORDER BY TimeStamp)

TotalMinutes: DateDiff('n',[LogT].[TimeStamp],(SELECT TOP 1 TimeStamp FROM LogT AS L2 WHERE L2.Username = LogT.Username AND L2.TimeStamp > LogT.TimeStamp ORDER BY TimeStamp))
Rusty Abernathy OP  @Reply  
     
2 years ago
Another nice thing is that I can put a button to click and see who is currently logged onto the database by using a very simple  query:SELECT LogOnQ.Username, LogOnQ.LogOnTime
FROM LogOnQ
WHERE (((LogOnQ.LogOffTime) Is Null));

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Track Log On.
 

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: 8/8/2026 3:27:34 AM. PLT: 1s