dbTalk Databases Forums  

datediff function and access database

comp.databases.ms-access comp.databases.ms-access


Discuss datediff function and access database in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
info@ceramcoceramics.com
 
Posts: n/a

Default datediff function and access database - 10-01-2004 , 10:45 AM






Can some one show me how to use the datediff function where the dates
are being supplied through an access db. For instance, a recordset
would contain these fields: DateAssigned, DateDue, ProjectName,
ProjectDetail, Class. The student enters a project name, then a date
it was assigned and a date it is due...and other details about the
project into the appropriate fields. The projects appear in a
databound list box...when you click on a project name in the list box
I want the student to see automatically (in a label) how many days are
left until that project is due and so forth as they scroll down the
list box projects. I'm a newbe and would appreciate some help. Thanks

Reply With Quote
  #2  
Old   
Wayne Morgan
 
Posts: n/a

Default Re: datediff function and access database - 10-01-2004 , 04:28 PM






Well, you can't do it directly in a label. To use a label, you would have to
do this in VBA code and change the Caption value of the label. What would
work better would be a textbox. You could format it to look like a label, if
you wish, and set its Locked property to Yes to keep the user from
attempting to edit it. You could then use an equation similar to the
following:

="There are " & DateDiff("d", Date, [DateDue]) & " day(s) left until this
project is due."

The [DateDue] is the name of the field. You can also refer to the name of
the textbox that displays the [DateDue] field. You will need to make the
textbox have a different name than the field it is bound to. For example, if
the field name is [DateDue] then try naming the textbox txtDateDue.

--
Wayne Morgan
MS Access MVP


<info (AT) ceramcoceramics (DOT) com> wrote

Quote:
Can some one show me how to use the datediff function where the dates
are being supplied through an access db. For instance, a recordset
would contain these fields: DateAssigned, DateDue, ProjectName,
ProjectDetail, Class. The student enters a project name, then a date
it was assigned and a date it is due...and other details about the
project into the appropriate fields. The projects appear in a
databound list box...when you click on a project name in the list box
I want the student to see automatically (in a label) how many days are
left until that project is due and so forth as they scroll down the
list box projects. I'm a newbe and would appreciate some help. Thanks



Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.