[Code Request] prevent adding new record, but after a period of date

Mohdhtm

New member
Local time
Tomorrow, 01:45
Joined
Oct 1, 2012
Messages
7
Dear friend Hello everybody,
Could you please help me to find a solution for this: -

I want code with message that can prevent user to adding a new record for an employee within specific of date through a form in the Ms Access database, but after a period of date i can,
For example (after two months of the last record on the main table i can add the new record, otherwise the message will popup tell the user that this employee didn't complete tow months of last adding)

I appreciate any help with this problem
Many thanks in advance.
 
If you use a form (and have the "create" date in the table), then use the form's On current event, to determine if the date in the table is older a 2 month from today.
 
If you use a form (and have the "create" date in the table), then use the form's On current event, to determine if the date in the table is older a 2 month from today.

HOW?
I didn't get your point???
 
Example: Use the DateAdd function
Unsure about the last record thing?

'Require 30 Days.
If DateDiff("d", [SomeDateField], Date) > 60 Then
Call MsgBox("You did not complete 2 months of Date Adding!", vbExclamation, Application.Name)
End If
 
HOW?
I didn't get your point???
Okay - I've made a small sample for you in the attached database.
Open the form - input a number in the "Edit after amount days:" ex. 6, and cycle thought the records. Look at the code behind the form's "On Current" event.
 

Attachments

Okay - I've made a small sample for you in the attached database.
Open the form - input a number in the "Edit after amount days:" ex. 6, and cycle thought the records. Look at the code behind the form's "On Current" event.

i appreciate your help, there is some issue on the code always messaging and it can add record,,,

i have attached my simple project for Clarifying my Request
 

Attachments

Use the code to test how many days have passed JHB suggested in his sample and after the given time has passed you can lock the controls in your form so the user can't edit hem
 

Users who are viewing this thread

Back
Top Bottom