Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mde problems

Status
Not open for further replies.

Odeysseus

Programmer
Apr 23, 2001
4
IE
I want to set my database to open for five times only, i know you have to create a table within an Mde file, but when the database starts up a form is called not an auotexec file, gwinn7 instructed on how to achieve this with an autoexec file how to you do it with a form....im really stuck
 
Well, in the form load you can open a recordset on a counter in a table, and then increment it if its less than 5 and exit if 5 or more. This would be better as a splash screen, then you could explain to the user that he/she isnt going to get any further. Peter Meachem
peter@accuflight.com
 
Since your in a MDE file you can not modify anything with code, including Modules, Reports, and Forms. So now you're left with Tables, Queries, and Macros.

Let's see...you want to open a DB only five times only.
Divide and Conquer:
(1)Create a table to store the number of times the DB has been opened.
Table Name: tblApplication
Fields: RecID Autonumber
TimesOpen Number-Integer

Create a record. Remember the RecID number and set the TimesOpen to zero. Let's say its equal to 1.

(2)Create an update query that will update TimesOpen value.
The SQL would look like the following:
UPDATE tblApplication SET tblApplication.TimesOpen = [TimesOpen]+1
WHERE (((tblApplication.RecID)=1));

(3)Create a Macro that will:
(a) Set your warnings off
(b) Run the update query that you created
(c) Set your warnings back on.
(d) CRITERIA: DLookUp("[TimesOpen]","[tblApplication]","[RecID]=1")>5; ACTION: Msgbox to the user that the application has expired.
(e) CRITERIA: DLookUp("[TimesOpen]","[tblApplication]","[RecID]=1")>5; ACTION: Quit (Shuts down Access)

(4)Run the macro from your Autoexec macro. If you don't have an Autoexec macro...create a macro, and name it Autoexec.


Hope this helps

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top