We help IT Professionals succeed at work.
Get Started

Trying to make date in new record default to the last date entered in previous record

SteveL13
SteveL13 asked
on
85 Views
Last Modified: 2015-10-02
I have a datasheet view form that show the records in DESC order because I want to see the last record at the top.

When I enter a new record that has a date field (short date format), I want the next record to default to whatever date I entered in the current record when I click on any field in the next record.  Does this make any sense?

I've tried these suggestions from previous Expert's help but none are working.  (all in the after update event of the date field)

    Me!txtReportingDate.DefaultValue = Me!txtReportingDate

Open in new window


    With Me!txtReportingDate
        If Not IsNull(.Value) Then
            Me!txtReportingDate.DefaultValue = "#" & Format(.Value, "yyyy\/mm\/dd") & "#"
        End If
    End With

Open in new window


Dim dtmMaxDateStamp As Date
Dim dtmPreviousDate As Date

             dtmMaxDateStamp = DMax("txtReportingDate", "tblHoursWorked")
             dtmPreviousDate = DLookup("txtReportingDate", "tblHoursWorked", "txtReportingDate= " & "#" & dtmMaxDateStamp & "#")
             Me.txtReportingDate = dtmPreviousDate

Open in new window

Comment
Watch Question
President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE