473,387 Members | 1,295 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Creating an ms access project which will run for 1 month only

Is it possible to create an ms access project which will run for a fixed period of time, after which the application will give a message "Validity Date has expired".If it is possible then please help me in writing the code.
Apr 1 '10 #1
2 1429
ADezii
8,834 Expert 8TB
You have not indicated your specific circumstances, so I'll just generalize. I'm assuming that you have a Main Form that you work off of. Set the Form's Timer Interval to 30000 (30 seconds), and place the following code in the Timer() Event of the Form. Every 30 Seconds, the code will check the Current Date against 5/1/2010. If it is May 1, 2010 or greater the User will be notified that the Validity Date has expired, then the Database will immediately Close without Saving any pending Updates.

P.S. - Obviously you can substitute your own Date in the Constant as well as a different Timer Interval. My initial idea was to execute the code when the Database Opens, but it is conceivable that a User can Open the DB prior to the Validity Date and leave it Open past the Validity Date, which would cause problems.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2. Const conDATE_TO_EXPIRE As Date = #5/1/2010#
  3.  
  4. If Date >= conDATE_TO_EXPIRE Then
  5.   MsgBox "Validity Date has expired", vbCritical, "Date expired"
  6.     DoCmd.Quit acQuitSaveNone
  7. End If
  8. End Sub
Apr 1 '10 #2
gershwyn
122 100+
Is it possible? Yes. But Access isn't really known for its robust security and a determined user could probably get in anyway. Here is my stab at it:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Function CheckDate()
  5.   If Now() > #3/31/2010# Then
  6.     MsgBox "Validity date has expired."
  7.     DoCmd.Quit acQuitSaveNone
  8.   End If
  9. End Function
  10.  
  11. Function SetBypassKey(BypassValue As Boolean)
  12.   Const conPropNotFound As Integer = 3270
  13.   On Error GoTo createProp
  14.   CurrentDb.Properties("AllowByPassKey") = BypassValue
  15.   Exit Function
  16.  
  17. createProp:
  18.   If Err = conPropNotFound Then
  19.     Dim Bypass As Property
  20.     Set Bypass = CurrentDb.CreateProperty("AllowByPassKey", dbBoolean, False)
  21.     CurrentDb.Properties.Append Bypass
  22.     Resume Next
  23.   End If
  24. End Function
1. First, make a copy of your database to work with. It would be unwise to block yourself out of your own work.
2. Create a macro named autoexec. In it, put the RunCode action and put CheckDate() in the arguments. If your database is code heavy, calling it at the beginning of important pieces of code will make it harder to get around as well.
3. From the immediate window, type SetBypassKey False. You'll only have to do this once for the database. This makes it so you can't hold down Shift while opening the database to skip the autoexec macro.
4. Convert the database to .accde / .mde so no one can see or modify your code.

That takes care of all the ways in I can think of, but like I said... I make no guarantees as to this being ironclad.
Apr 1 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jeremy Weiss | last post by:
Thanks to much help from everyone in my previous thread, I've made it a pretty fair ways into my billing/invoicing db. I'm now needing a way to cycle through all the records in a table and create...
2
by: Jon | last post by:
Whilst I am early on in the project can any one please give me a bit of advice on handling months in a simple data base. what the month field needs to do is just list the month but I do need to...
6
by: user451 | last post by:
As the most Access-savvy person in my office, I have been handed the task of proposing a nationwide expansion of a project that I have developed in Access. A brief overview: Right now, about 25...
6
by: Jerry Spence1 | last post by:
Why doesn't the following work in my ASP program? I have imported ADOX I am trying to create a temporary database on the user's PC. The example is taken from Microsoft. Dim cat As Catalog =...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
4
by: RSH | last post by:
Hi, I have a situation where I have created a little application that makes an Access database from a SQL Database for reporting purposes. it does the job well, but it seems a bit slow. Is...
1
by: john saul | last post by:
Hello All, I am not extremely new to Access but need help to hopefully a simple question. I am creating a project quote form that will ask customers questions and retreive pricing due to the...
5
by: Kuna | last post by:
Hi All, I am trying to create a gantt chart in php by getting data from database. I am using WindowsXp OS and having php-4 and my-sql DB. I have installed the JPGRAPH package to my system and...
21
by: nihad.nasim | last post by:
Hi there, I have a database in Access that I need on the web. The web page should connect to the database and write records for certain tables and view records for others. I want to know a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.