datediff function and access database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • info@ceramcoceramics.com

    datediff function and access database

    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
  • Wayne Morgan

    #2
    Re: datediff function and access database

    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@ceramcoce ramics.com> wrote in message
    news:415d7b7d.9 996937@news.alt .net...[color=blue]
    > 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[/color]


    Comment

    Working...