Solved

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

Posted on 2016-10-05
4
55 Views
Last Modified: 2016-10-24
Hi,I'm having trouble with my birthday where the year 1966
0
Comment
Question by:Karen Halls
[X]
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
  • 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 50

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 50

Expert Comment

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

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

730 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