Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Im have trouble getting in where it says birthday only with the year

Posted on 2016-10-05
4
52 Views
Last Modified: 2016-10-24
Hi,I'm having trouble with my birthday where the year 1966
0
Comment
Question by:Karen Halls
  • 2
4 Comments
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points (awarded by participants)
ID: 41830971
not sure to understand. can you elaborate more on your structure and what you are trying to do?

blind guess:
select * from yourtable where year(yourdatefield) = 1966

Open in new window

0
 
LVL 28

Expert Comment

by:Pawan Kumar
ID: 41831012
Can you provide more information like table structure and what you are trying to achieve.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 250 total points (awarded by participants)
ID: 41831212
That will be:

Public Function ShowBirthday1966(ByVal Birthday As Date)

    Const BirthdayYear As Integer = 1966

    Dim Birthday1966 As Variant
    Dim Title As String

    Title = "Birthday" & Str(BirthdayYear)

    If Year(Birthday) > BirthdayYear Then
        Birthday1966 = Null
        MsgBox "You were not born.", vbExclamation + vbOkOnly, Title
    Else
        Birthday1966 = DateSerial(BirthdayYear, Month(Birthday), Day(Birthday))
        MsgBox "Your birthday of" & Str(BirthdayYear) & " is " & Format(Birthday1966, "yyyy-mm-dd"), vbInformation + vbOkOnly, Title
    End If

    ShowBirthday1966 = Birthday1966 

End Function

Open in new window

Now call this (replace 1/1/1980 with your birthday):

? ShowBirthday1966(#1/1/1980#)
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 41856716
The answers are best guesses.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question