Results 1 to 6 of 6

Thread: Modifying date in access

  1. #1
    Join Date
    Nov 2009
    Posts
    518

    Modifying date in access

    Hello
    I desperately seek how to put a form in Access 2003 as the date of last modification of a field. Finally I found this code
    Code:
    Public Function getdtupfrm(strFormName As String) As Date
    Sun odatab As DAO.Database
    Set odatab = CurrentDb
    getdtupfrm = odatab.Containers("Forms").Documents(strFormName).LastUpdated
    End Function
     
    Sub test()
    MsgBox getdtupfrm("Form1")
    End Sub
    But this does not works, do you guys have any idea about the same. Please help, thanks in advance.
    Last edited by GlassFish; 04-01-2010 at 08:51 AM.

  2. #2
    Join Date
    May 2008
    Posts
    4,831

    Re: Modifying date in access

    Hello
    The date does not appear or is not what you expect? What is the main concern.
    By turning your code line by line, see if you return values appear consistent. I think the code should display the date. If it is displaying the date and you do not want the format of date, instead you want some other format, then we can help you, but for that you have to post what exactly is the date i.e what is the format of the date.

  3. #3
    Join Date
    Nov 2009
    Posts
    518

    Re: Modifying date in access

    Hello,
    But the date is not displayed. I shall like this- I created a table in the fields of SHIFT DATE DATE / TIME then in the form I create a text box, I am in the property / tab / event in "Change" code generator and the VB I paste the code below. I record and I do a modified form such as name and date does not appear in the fields. I do not know where I am going wrong? Please guide if I am wrong.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,139

    Re: Modifying date in access

    Hello,
    I think you are probably missing the reference to the DAO library. That said, I wonder if you do not go wrong in your code part. The code that you want to use will give you the last modified date of the form itself, the date on which you'll have saved after modification to the last. It seems rather that you want to keep the last Modification of the data contained in a specific field of a record.

  5. #5
    Join Date
    Nov 2009
    Posts
    518

    Re: Modifying date in access

    Hi.
    This is what i would like to do-
    1: having a field "Date Modified" in a table "Customer".

    2: in the client form, I would find the customer info. Now I want to edit a field in this form, the field "phone" for example and this is where all begins.

    3: the field "Date Modified" should be completed by the date and it automatically updates the same field and already completed by a date earlier it will replace.

  6. #6
    Join Date
    May 2008
    Posts
    3,316

    Re: Modifying date in access

    Hello,
    From what I understand, it is perhaps just use the Before Update event of the form.
    Example:
    Form Properties Events Tab
    Before Update: Event Procedure
    then click on the button to the right of this box to open the code editor.
    and write
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
     [date update] = Date()
    End sub

Similar Threads

  1. Grouping dates in Access by date components
    By DeepikaP in forum Windows Software
    Replies: 4
    Last Post: 04-02-2011, 07:12 PM
  2. How to Querying blank records iso date in access
    By Quattro in forum Windows Software
    Replies: 3
    Last Post: 31-07-2009, 10:20 AM
  3. Need help with date functions in Access.
    By Sachit in forum Software Development
    Replies: 1
    Last Post: 04-02-2009, 06:46 PM
  4. Replies: 0
    Last Post: 13-10-2008, 04:35 PM
  5. Date() function problem in Access 2000.
    By Jerzy in forum Software Development
    Replies: 3
    Last Post: 30-07-2008, 03:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,265,336.08071 seconds with 17 queries