- Function LogonLog(OnOff As String)
-
Dim rst As DAO.Recordset
-
If OnOff = "On" Then
-
Set rst = CurrentDb.OpenRecordset("tblLogonLog", dbOpenDynaset, dbAppendOnly)
-
rst.AddNew
-
rst!StaffID = LogStaffID
-
rst!Logon = Now()
-
rst.Update
-
ElseIf OnOff = "Off" Then
-
Set rst = CurrentDb.OpenRecordset("SELECT Max(tblLogonLog.LID) AS LID FROM tblLogonLog HAVING (((tblLogonLog.StaffID)=1) AND ((tblLogonLog.LogOff) Is Null));")
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL ("UPDATE tblLogonLog SET tblLogonLog.LogOff = Now() WHERE (((tblLogonLog.LID)=" & rst!LID & "));")
-
DoCmd.SetWarnings True
-
End If
-
rst.Close
-
End Function
Hello, i have some code that records logon/off time and date at logon/off and i think the log off is a bit sloppy, wondered if there was a better/more efficient way? of course i need to know the LineID (LID) to match on and off which is where my problem arises. one thing i wondered is can you read the value (autonumber) whilst appending by DAO (in the logon) so that i can store it as global variable?
thanks for any help
2 1857 ChipR 1,287
Recognized Expert Top Contributor
You don't need to open a recordset for either of these things. For example, I keep the logon time in a global variable. Here's the code I've been using for a while. -
Private Sub StartUp()
-
On Error GoTo ErrorHandler
-
...
-
startTime = Now
-
strSQL = "INSERT INTO UsageLog (StartTime, UserName, Workstation) VALUES (#" _
-
& startTime & "#, """ & userName & """, """ & Workstation & """);"
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL strSQL, 0
-
DoCmd.SetWarnings True
-
...
-
'Show Main Menu is in here somewhere
-
End Sub
-
-
'Form Unload for the Main Menu
-
Private Sub Form_Unload(Cancel As Integer)
-
On Error GoTo ErrorHandler
-
Dim strSQL As String
-
'record user log off
-
strSQL = "UPDATE UsageLog SET EndTime = #" & Now & "# WHERE StartTime = #" & startTime & "#;"
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL strSQL, 0
-
DoCmd.SetWarnings True
-
...
-
End Sub
spose that would work, never thought about saving start time lol i was focused on the autonumber.
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ricolee99 |
last post by:
Hi everyone,
I'm trying to invoke my .exe application from a remote server. Here is
the code:
ManagementClass processClass = new ManagementClass ("\\\\"
+"RemoteServerName"
+
"\\root\\CIMV2:Win32_Process");
|
by: gonzal51 |
last post by:
Hi, I'm a student learning C++ and my professor isn't much help, her view is
if you dont get it I ain't helping you....
We are supposed to do a basic program as a logon system. I got as far as I
could and came up with some errors I could not understand.
Any Help would be appreciated.
Using: MS Visual Studio .Net 2003
|
by: Sakharam Phapale |
last post by:
Hi All,
I am developing an application like sound recorder.
While recording if there is a silence for more than given time (say 5
seconds),
Recording should be paused.
|
by: David |
last post by:
Hi, I was hoping someone could confirm the following about the
following number 2 SQL query:
1. This extracts the data required given that there is a recording to
match the records
2. This should, but im not convinced extract all the remaining records
that do not have a matched recording, but fulfil the rest of the
criteria. If not please help...
|
by: zhangzhi |
last post by:
HI£º
i have a big problem about audio recording. my boss wanna a application
of audio monitor, and he wanna it will detect voice and start recording
automatically, avoiding recording silences.
thanks for giving me a little clue, and Great U for sending me a copy of
code of C#. or I will be Fired in a week.
| |
by: chris.thomson |
last post by:
Hi,
Thanks in advance for any assistance regarding my question.
I have setup a database with a WIF containing the usernames and p/words
of several unique data entry operators who will be entering data into
the database.
I would like to know how I record the username of each unique data
entry operator against any entries they input into the database?
|
by: jer |
last post by:
I've noticed you've helped a lot of people that were trying to do sound
recording through VB.net. I'm searched all over the internet, and I'm
still having problems write sound to a wav file.
My code originate from a VB 6 application, and I'm trying to use vb
2005. I was having a lot of issues until I saw your post that cleaned
up a lot of the structures and DLL calls in this:
...
|
by: taaz |
last post by:
I'm developing the Delay Audiometry feedback.
My Step are... Recording -> Playing... these are on different events.
I've used the mcisendstring()for manipulation of audio & made the functions
For Recording I used
=======================================================
Dim settings As String
Dim Alignment As Integer
|
by: tahirahmed |
last post by:
Hello,
Before i start programming my application in C# I want ask a few things about directX capture class.
My application scenario
I want to design an application which is able to detect video signal, here i am using my Nvidia Geforce 6600 graphics card as video input device, the video source is a small camera which is outputting the video through composite video cable and that cable is attached to the input connector of my vga card.
...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |