473,779 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

One last command before DB closes

Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the 'Logged_out'
time and then quits the application. My problem is that when users click on
the cross (top right corner) to close the database, this time is not logged.

Is there a way in which I can still log the time even when they click on the
application close button or a way in which I can hide the close button so
that the only way the application can be shut down is via my close button?

TIA

Mark
Nov 13 '05 #1
6 1385
One common approach to this problem is to have a small form (its visible
property can even be set to False) which opens on startup and remains open
throughout the time the application is open. Closing Access causes this
form to close, so code in its Close event executes. Put your "logout" code
there.

HTH
- Turtle

"Mark R" <ma*********@nt lworld.com> wrote in message
news:XH******** ******@newsfe2-gui.ntli.net...
Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the 'Logged_out' time and then quits the application. My problem is that when users click on the cross (top right corner) to close the database, this time is not logged.
Is there a way in which I can still log the time even when they click on the application close button or a way in which I can hide the close button so
that the only way the application can be shut down is via my close button?

TIA

Mark

Nov 13 '05 #2
"Mark R" <ma*********@nt lworld.com> wrote in message news:<XH******* *******@newsfe2-gui.ntli.net>.. .
Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the 'Logged_out'
time and then quits the application. My problem is that when users click on
the cross (top right corner) to close the database, this time is not logged.

Is there a way in which I can still log the time even when they click on the
application close button or a way in which I can hide the close button so
that the only way the application can be shut down is via my close button?

TIA

Mark

Lemme see if I remember the answer to this one.... open a hidden form
when the database starts up, and then have it write to the Logins
table. Then when the user logs out, grab his login from today, update
it with the logout, and update the record in the Form's close event.
Nov 13 '05 #3
Use the Unload event in Access...

http://msdn.microsoft.com/library/de...cevtUnload.asp

I created a blank database, added a "close" button and a displayed a
message saying that button was clicked. I also tossed a message box
into the Form Unload event saying the form is being unloaded. When
you click the button both message boxes show up... when you close the
database (by clicking the X or Cross not the button on the form) it
just displays the unload event message box.

- Craig

"Mark R" <ma*********@nt lworld.com> wrote in message news:<XH******* *******@newsfe2-gui.ntli.net>.. .
Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the 'Logged_out'
time and then quits the application. My problem is that when users click on
the cross (top right corner) to close the database, this time is not logged.

Is there a way in which I can still log the time even when they click on the
application close button or a way in which I can hide the close button so
that the only way the application can be shut down is via my close button?

TIA

Mark

Nov 13 '05 #4
Thanks for the suggestion, however, The main form is open all the time and
the "logout" code is in the "OnClose" property of this form. The problem I
have is when the Db is opened, the user sees a login form. The user then
enters their login and password. When they click on a command button the
username is appended to a temp table within the frontend and in the logging
table within the backend (along with date/time opened).
As there may be several users at any time, the time logged out needs to be
reference with the current user. This is done by having a bound text box on
the main form to the temp table within the frontend. The "OnClose" command
is:
Private Sub Form_Close()
'record the time at which users logged out
On Error GoTo err_form_close

DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE user_logging SET user_logging.Ou t = Now() WHERE
(((user_logging .Out) Is Null) AND ((user_logging. Form)='Main Menu') AND
((user_logging. username)= forms!master_pa ge!userid));"

'delete the current user field
DoCmd.RunSQL "delete * from current_user;"

exit_form_close :
Exit Sub

err_form_close:
MsgBox Err.Description
Resume exit_form_close
End Sub

If the form is closed before the app is quit then there is not problem but
if the app is quit before the form is closed, the form loses the value and
then the user id prompted for forms!master_pa ge!userid.

I hope I have explained this ok?

Mark

"MacDermott " <ma********@nos pam.com> wrote in message
news:zC******** ***********@new sread2.news.atl .earthlink.net. ..
One common approach to this problem is to have a small form (its visible
property can even be set to False) which opens on startup and remains open
throughout the time the application is open. Closing Access causes this
form to close, so code in its Close event executes. Put your "logout" code there.

HTH
- Turtle

"Mark R" <ma*********@nt lworld.com> wrote in message
news:XH******** ******@newsfe2-gui.ntli.net...
Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the

'Logged_out'
time and then quits the application. My problem is that when users click

on
the cross (top right corner) to close the database, this time is not

logged.

Is there a way in which I can still log the time even when they click on

the
application close button or a way in which I can hide the close button so that the only way the application can be shut down is via my close button?
TIA

Mark


Nov 13 '05 #5
Two possibilities you might try:
Use the Form_Unload event, rather than Form_Close.
Store the UserName in a global variable, rather than a textbox on the
form.

HTH
- Turtle

"Mark R" <ma*********@nt lworld.com> wrote in message
news:yf******** *******@newsfe6-gui.ntli.net...
Thanks for the suggestion, however, The main form is open all the time and
the "logout" code is in the "OnClose" property of this form. The problem I
have is when the Db is opened, the user sees a login form. The user then
enters their login and password. When they click on a command button the
username is appended to a temp table within the frontend and in the logging table within the backend (along with date/time opened).
As there may be several users at any time, the time logged out needs to be
reference with the current user. This is done by having a bound text box on the main form to the temp table within the frontend. The "OnClose" command
is:
Private Sub Form_Close()
'record the time at which users logged out
On Error GoTo err_form_close

DoCmd.SetWarnin gs False
DoCmd.RunSQL "UPDATE user_logging SET user_logging.Ou t = Now() WHERE
(((user_logging .Out) Is Null) AND ((user_logging. Form)='Main Menu') AND
((user_logging. username)= forms!master_pa ge!userid));"

'delete the current user field
DoCmd.RunSQL "delete * from current_user;"

exit_form_close :
Exit Sub

err_form_close:
MsgBox Err.Description
Resume exit_form_close
End Sub

If the form is closed before the app is quit then there is not problem but
if the app is quit before the form is closed, the form loses the value and
then the user id prompted for forms!master_pa ge!userid.

I hope I have explained this ok?

Mark

"MacDermott " <ma********@nos pam.com> wrote in message
news:zC******** ***********@new sread2.news.atl .earthlink.net. ..
One common approach to this problem is to have a small form (its visible
property can even be set to False) which opens on startup and remains open
throughout the time the application is open. Closing Access causes this
form to close, so code in its Close event executes. Put your "logout"

code
there.

HTH
- Turtle

"Mark R" <ma*********@nt lworld.com> wrote in message
news:XH******** ******@newsfe2-gui.ntli.net...
Hi Guru's,
I have a frontend application where my boss wants to when people are using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the

'Logged_out'
time and then quits the application. My problem is that when users
click on
the cross (top right corner) to close the database, this time is not

logged.

Is there a way in which I can still log the time even when they click
on the
application close button or a way in which I can hide the close button

so that the only way the application can be shut down is via my close button?
TIA

Mark



Nov 13 '05 #6
Thanks all, I moved the code to OnUnload and it works fine.

Cheers all,

Mark

"Mark R" <ma*********@nt lworld.com> wrote in message
news:XH******** ******@newsfe2-gui.ntli.net...
Hi Guru's,
I have a frontend application where my boss wants to when people are
using the database.
I have a form which OnOpen, inserts the username, network login and
date/time it was opened to a table.
I have created a 'Close' button which when clicked, updates the 'Logged_out' time and then quits the application. My problem is that when users click on the cross (top right corner) to close the database, this time is not logged.
Is there a way in which I can still log the time even when they click on the application close button or a way in which I can hide the close button so
that the only way the application can be shut down is via my close button?

TIA

Mark

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3103
by: jrf[no] | last post by:
Hi all, I was getting a 500 error and someone adviced me to run the php file from the command line to check what errors that would come up with. Great idea which I'd like to use, but when I use the Windows "run" box to do this, I see a window open and close so quickly that there's no way for me to read what's come up. How can I force the window to stay open after the program has finished ?
3
1370
by: Dubya | last post by:
Hello Everyone, I have this little app, that I would like to configure two modes of operation by using command line arguments. If the app is started with no arguments, the Main UserForm shows up, if the app is started with an argument of -q it runs in Quiet Mode. Where a form pops up, runs the process I need run without user intervention and then closes. I'm having a problem when the app runs with -q, it starts the Quiet Mode form......
4
7058
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm, "frmReportOptions" <== popup form This is the error I get when I try to move to the last page of the report *after* closing the popup: "This expression is typed incorectly, or is too complex to be evaluate...."
2
21839
by: tripyre | last post by:
I recently resolved an issue I had with passing a variable to a call shell command, but now I need it to pause or leave the window open so I can manually close it. Below is my code, and I am not sure where to begin to keep the DOS window from closing. Dim stAppName As String Dim stIPAddress As String stAppName = "C:\WINDOWS\system32\ping.exe " stIPAddress =
2
8138
by: Tim | last post by:
Hi, I want to run some command line instructions from within my C# windows forms application. Basically when the application closes I want to logoff the session if it was started remotely. So how do I run text as if I was typing it into the command line? Tim
6
5811
by: =?Utf-8?B?VGhvbWFzWg==?= | last post by:
Hi, Is it possible to read a file in reverse and only get the last 100 bytes in the file without reading the whole file from the begining? I have to get info from files that are in the last 100 bytes of the file and some of these files are 600Mb -1 GB in size. I am getting "outofMemory.." exceptions on the largest files and the other files take "forever" to get the last 100 bytes. This is the code I have currently that works with...
0
1282
by: Tharpa Roberts | last post by:
Under Visual C++ 6.0, if you made a command-line program, it would stay open after execution, and then you would press any key to close it. Under Visual Studio 2005, if you make a C++ command line program, the program instantly closes after execution (not even enough time to read what it says) if the program created its own command line window. (It does stay open if you run the program from a command-line.) What do I have to do to...
4
3758
by: enggwaqas | last post by:
I have an Oracle stored procedure that takes approx 3 minutes to execute and I am using .net 2.0 data access provider for oracle. Now i want to cancel the execution of stored procedure from .net after few seconds, the code i wrote for this is: //Start main function System.Data.OracleClient.OracleDataAdapter objAdapter; System.Data.OracleClient.OracleConnection con; System.Threading.Timer objTimer = null;
4
2693
by: boriq | last post by:
Hi, I'm using in my script command os.system('command') on Windows XP. Each time the os.system command is used, python opens an empty ms-dos command window (the black one) and then closes it. So when in one script the os.system command 50 times is used, I see 50 black windows. Is there a way of how to suppress this unnecessary command windows to be opened?
0
9471
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,...
1
10071
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,...
0
9925
tracyyun
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...
0
8958
agi2029
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...
1
7478
isladogs
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...
0
6723
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();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
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
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.