UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Run Time Error 3075, Access 2010    
 
   
habiler
post Dec 20 2017, 02:38 AM
Post#1



Posts: 60
Joined: 6-August 15



What's Matter with my code.
He gives me an error time 3061 Expected 1 or 3075 (In this case 3061)

What's wrong with my code.

CODE
Function ChildLT12YbyPerson(Matr As Long, DateNaiss As Date)

Dim rs3 As DAO.Recordset
Dim strSQL3 As String
Dim CountOfBirthdates As Integer



    strSQL3 = "SELECT EMPLOYEENBR, Count([BIRTHDATE]) AS CountofBirthdates FROM Enfts  WHERE BIRTHDATE >= DateAdd(YYYY, -12, #01/01/2000#) and EMPLOYEENBR = " & Matr & " GROUP BY EMPLOYEENBR  "
    Set rs3 = CurrentDb.OpenRecordset(strSQL3)
Debug.Print strSQL3
    With rs3
        If Not (.EOF And .BOF) Then .MoveFirst
        While Not .EOF
         ' While Not LT12Y > 11
    
      ChildLT12YbyPerson = CountOfBirthdates
            .MoveNext
           ' Wend
        Wend
        
        .Close
        Debug.Print "Enfants = :"; Matr, DateNaiss, ChildLT12YbyPerson
    End With
    
    Set rs3 = Nothing
End Function
Go to the top of the page
 
Doug Steele
post Dec 21 2017, 12:17 PM
Post#2


UtterAccess VIP
Posts: 21,811
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Try DateAdd('YYYY', -12, #01/01/2000#) (or DateAdd(""YYYY"", -12, #01/01/2000#))

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
http://www.accessmvp.com/DJSteele/AccessIndex.html
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th July 2018 - 06:16 PM