Results 1 to 4 of 4
  1. #1
    vector39 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    May 2017
    Posts
    76

    How to get report to display inputted dates

    Hi everyone, I have a continuous form where users can enter dates as seen here:

    Click image for larger version. 

Name:	AADates.PNG 
Views:	8 
Size:	2.3 KB 
ID:	31539

    I also have this other form where users can enter a date range that will display records within that range, as seen here:

    Click image for larger version. 

Name:	datesform.PNG 
Views:	8 
Size:	6.6 KB 
ID:	31541

    Note here that I have entered a test record with the start date being 6-Dec-12 and the end date being 8-Dec-12. I should only get back two records (one is a real record the other is this fake one I have created) but instead the result is this:

    Click image for larger version. 

Name:	report.PNG 
Views:	8 
Size:	10.4 KB 
ID:	31540



    The report only gave me back the one already existing record but not the fake one. I also noticed when I went back to the form, the date fields appeared blank, even after hitting save and close).

    Click image for larger version. 

Name:	blankdates.PNG 
Views:	8 
Size:	1.7 KB 
ID:	31542

    The vba for the button to open up the reports is as follows:

    Code:
    Private Sub cmdAAReport1_Click()
    
        Dim strCriteria As String
        
        If Not IsNull(Me.txtStart1) Then
            strCriteria = " And AAExpiryDate >= #" & _
                Format(Me.txtStart1, "yyyy-mm-dd") & "#"
        End If
        
        If Not IsNull(Me.txtEnd1) Then
            strCriteria = strCriteria & " And AAExpiryDate < #" & _
                Format(Me.txtEnd1 + 1, "yyyy-mm-dd") & "#"
        End If
        
        ' remove leading ' And '
        strCriteria = Mid(strCriteria, 6)
        
        ' open report
        DoCmd.OpenReport "rptAAExpiryDate", _
            View:=acViewReport, _
            WhereCondition:=strCriteria
    
    End Sub
    If anyone knows what this is and has feedback. That would be greatly appreciated!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    put it in the query.
    StartDte: forms!myForm!txtStartDate
    EndDte: forms!myForm!txtEndDate

    then just drag the fields onto the report.

  3. #3
    vector39 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    May 2017
    Posts
    76
    Quote Originally Posted by ranman256 View Post
    put it in the query.
    StartDte: forms!myForm!txtStartDate
    EndDte: forms!myForm!txtEndDate

    then just drag the fields onto the report.
    Hi,

    So I did as you suggested and the rests are the same. I notice, whenever I go back to the record I just entered, the dates I entered are still not visible as seen here:
    Click image for larger version. 

Name:	blankdates.PNG 
Views:	6 
Size:	1.7 KB 
ID:	31543
    For some reason on this continuous form, it's not letting me add new dates for new records. And when I click on the report itself, I'm prompted with this message:
    Click image for larger version. 

Name:	prompt.PNG 
Views:	6 
Size:	3.7 KB 
ID:	31544

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There seems to be two issues going on here,
    - form not saving record
    - report not recognizing dates

    Get them working one by one. Find out why your form is not saving your record, go to the table and make sure that it is the case or if it is a form display problem. If the former, then it may have to do with the record source not allowing additions.

    Then in the query that is used as the record source for your report, reference the two dates as described in post # 2.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-19-2017, 11:31 AM
  2. Replies: 1
    Last Post: 06-25-2015, 01:12 PM
  3. Replies: 2
    Last Post: 02-19-2015, 02:19 PM
  4. Replies: 3
    Last Post: 11-14-2014, 02:51 PM
  5. display all dates between two dates
    By KenThompson in forum Access
    Replies: 8
    Last Post: 02-23-2011, 01:11 PM

Tags for this Thread

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