Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004

    Unanswered: store default value

    Hi All,

    I have a form with a field called date. Just after I am adding a new record to my database by pressing one of the form's buttons the field date returns to it's default value. I would like it to store the value I have just typed in the field as it's default value for new records.

    Anybody could help me?

  2. #2
    Join Date
    Jun 2004
    Saratoga Springs
    Let me make sure I understand:

    You want to dynamically update the default value of your date field to the date value you entered on the last record.

    This is one way to do that...


    Option Compare Database

    Private Sub Form_Open(Cancel As Integer)

    var_date = DLookup("date", "q1", "ID = (SELECT MAX(ID) FROM q1)")

    txt_date.DefaultValue = "#" & var_date & "#"

    End Sub

    Private Sub txt_date_AfterUpdate()

    txt_date.DefaultValue = "#" & txt_date & "#"

    End Sub


    I included the open form event to look for the date of the most recently entered record.

    A sample A2K database is attachted to this message.

    hope this helps
    Attached Files Attached Files
    Last edited by santiago_jon; 07-16-04 at 02:07.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts