A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Event Procedure to lookup value in table and perform action based onvalue



 
 
Thread Tools Display Modes
  #1  
Old July 22nd, 2009, 03:50 PM posted to microsoft.public.access.tablesdbdesign
steve
external usenet poster
 
Posts: 2
Default Event Procedure to lookup value in table and perform action based onvalue

I have a table called dates that has only one row and one column with
one date value. I want to write an event procedure on the Open Event
of a form that looks the value in the dates table and, if the current
date is greater than the value in the table, the form would close.

I am not sure what code or commands to use since I'm not that familiar
with writing Event Procedures.

Any help would be appreciated.

Steve
  #2  
Old July 22nd, 2009, 04:11 PM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default Event Procedure to lookup value in table and perform action based on value

"steve" wrote in message
...
I have a table called dates that has only one row and one column with
one date value. I want to write an event procedure on the Open Event
of a form that looks the value in the dates table and, if the current
date is greater than the value in the table, the form would close.

I am not sure what code or commands to use since I'm not that familiar
with writing Event Procedures.

Any help would be appreciated.

Steve


Date is a reserved word in Access so if you're using it as a field name I'd
recommend changing it to something like fldDate. Check out the DLookup
function in the help, that should do what you want in the form's Open event.

Keith.
www.keithwilby.co.uk

  #3  
Old July 22nd, 2009, 10:36 PM posted to microsoft.public.access.tablesdbdesign
Larry Daugherty
external usenet poster
 
Posts: 1,012
Default Event Procedure to lookup value in table and perform action based on value

Compare [DLookup() the value in that table and field] with Now().

HTH
--
-Larry-
--

"steve" wrote in message
...
I have a table called dates that has only one row and one column

with
one date value. I want to write an event procedure on the Open

Event
of a form that looks the value in the dates table and, if the

current
date is greater than the value in the table, the form would close.

I am not sure what code or commands to use since I'm not that

familiar
with writing Event Procedures.

Any help would be appreciated.

Steve



  #4  
Old July 22nd, 2009, 11:22 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Event Procedure to lookup value in table and perform action based on value

Steve

If you want to compare to the current date/time value, use the Now()
function Larry mentioned.

If you want to compare to only the current date portion, use the Date()
function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Larry Daugherty" wrote in message
...
Compare [DLookup() the value in that table and field] with Now().

HTH
--
-Larry-
--

"steve" wrote in message
...
I have a table called dates that has only one row and one column

with
one date value. I want to write an event procedure on the Open

Event
of a form that looks the value in the dates table and, if the

current
date is greater than the value in the table, the form would close.

I am not sure what code or commands to use since I'm not that

familiar
with writing Event Procedures.

Any help would be appreciated.

Steve





  #5  
Old July 23rd, 2009, 05:00 PM posted to microsoft.public.access.tablesdbdesign
Dale_Fye via AccessMonster.com
external usenet poster
 
Posts: 128
Default Event Procedure to lookup value in table and perform action based onvalue

Personally, I think I'd do the check before I open the form.

I assume that some event is causing the form to be opened. If that is the
case, I'd do the test before I even open the form. And if the event that
opens the form is tied to a command button, I might go so far as to disable
or hide the button if your criteria would prevent the form from opening.

The reason I say this is that cancelling a form opening will generate an
error, which you must handle; but if you do your test before you try to open
the form, you don't have to handle the error.

Just my 2 cents.

Dale

steve wrote:
I have a table called dates that has only one row and one column with
one date value. I want to write an event procedure on the Open Event
of a form that looks the value in the dates table and, if the current
date is greater than the value in the table, the form would close.

I am not sure what code or commands to use since I'm not that familiar
with writing Event Procedures.

Any help would be appreciated.

Steve


--
HTH

Dale Fye

Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.