interrupt form load/open based on a system date

M

macs

I have an immediate need to interrupt a form from being loaded after a specific period of time - 30 days from a hard coded date - based on the system date. I am not a programmer so I'm looking for an easy macro that could be incorporated into the program? In addition, before the form "doesn't load", I would like to tell the user that the form will not be loaded.

Here's what I have now: A macro on the "on load" of the form with the message box then closes the window.
Here's what I need: A condition/command/function/etc. that checks the system date and if it is > my hard coded date (30 days) that it will display the message and not close the window. If it is <= my hard coded date, display the message that the form will not load and closes the window.

Since I am not a developer, I'm looking for exact text, commands, actions, arguments, etc. to be used and where to put it? Thanks
 
S

Steve Schapel

Macs,

If you're looking for exact specifics, it would have been good for you
to have supplied specifics of what you've got and what you want :) I
will assume your "hard coded" date is stored in a table.

Go to the design of your macro. If you can't see a Conditions column in
the design window, select Conditions from the View menu.

If you want the form to load, and then to tell the user after this that
the form will not load, I guess it would be good for the form to
initially be opened hidden. Yes?

So, here's an idea...

Condition: Date()>DLookup("[YourHardCodedDate]","YourTable")
Action: MsgBox
Message: "Your stay open message"
Condition: ...
Action: SelectObject
Object Type: Form
Object Name: NameOfYourFormWhateverItIs
In Database Window: No
Condition: Date()<=DLookup("[YourHardCodedDate]","YourTable")
Action: MsgBox
Message: "Your gonna close message"
Condition: ...
Action: Close
Object Type: Form
Object Name: NameOfYourFormWhateverItIs

Hope this points you in the right direction.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top