Results 1 to 2 of 2
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    .defaultvalue isn't working with a date

    Hey guys,

    I have the attached form: Click image for larger version. 

Name:	Screen Shot 2014-10-21 at 11.55.12 AM.png 
Views:	5 
Size:	25.6 KB 
ID:	18445



    That date without a label is set via VBA if the Salesperson is selected as "House Sales" (it is set to "" if any other salesperson is selected). That part works fine. I use the following code to accomplish this:
    Code:
    Private Sub SlspSelect_AfterUpdate()
    Const cQuote = """"
    Me.SlspSelect.DefaultValue = cQuote & Me.SlspSelect.Value & cQuote
    Me.EmpCode = Me.SlspSelect.Column(3)
    Me.EmpCode.DefaultValue = cQuote & Me.EmpCode.Value & cQuote
    
    
    
    
    If Me.SlspSelect.Value = "House Sales" Then
        Me.EorL.Value = 1
        Me.EorL.DefaultValue = 1
        Me.NextMailed = Forms![View Records]![NextAdDate]
        Me.NextMailed.DefaultValue = Forms![View Records]![NextAdDate]
        Else
        Me.EorL.Value = 2
        Me.EorL.DefaultValue = 2
        Me.NextMailed = ""
        Me.NextMailed.DefaultValue = ""
    End If
    
    
    
    
    End Sub
    After a user types in the desired data, and hits the tab key in the final field a new record starts, except the date value changes to 12/30/1899. What am I doing wrong here?

    I have NextMailed formatted as a short date, as well as Forms![View Records]![NextAdDate].

  2. #2
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    ... I swear I solve 90% of my questions the second I post them on here.

    Added "#" in front of and behind:
    Code:
    Me.NextMailed.DefaultValue = "#" & Forms![View Records]![NextAdDate] & "#"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-26-2013, 09:25 AM
  2. If then using a date not working
    By epb in forum Programming
    Replies: 4
    Last Post: 09-25-2012, 09:58 AM
  3. Replies: 3
    Last Post: 09-19-2012, 08:59 AM
  4. Replies: 3
    Last Post: 07-08-2010, 01:47 PM
  5. Replies: 2
    Last Post: 11-04-2009, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums