Solved

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

Posted on 2016-10-05
4
62 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 29

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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

695 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