Showing List of Names with Birthdays (1 Viewer)

giddyhead

Registered User.
Local time
Today, 02:45
Joined
Jul 3, 2014
Messages
88
Good Day,

I am seeking help in finding a way in showing the list of names in a label from a table of birthdays that fall within this month and the following month using a filter filtering by Departments if needed. For example:
Departments(HR,IT,Medical,Supply)
Names: (Well, Joe, DEPT:HR, DOB: 05/04/1956), (Smith, Jane, DEPT: Medical, DOB 01/01/1987), (Friend, My, DEPT: HR DOB 04/03/1995), (Calvo,Its DEPT: Supply, DOB 02/01/1990),
(Care,Eye DEPT: IT, DOB05/15/1997O)


The result will only show Well, Joe & Friend, My. Thanks for your help.
 

isladogs

MVP / VIP
Local time
Today, 07:45
Joined
Jan 14, 2017
Messages
18,252
Answering on a tablet so there may be typos

Create a query with fields Name, DOB and BirthMonth where BirthMonth is DatePart("m",DOB)
Add filter to BirthMonth where criteria is DatePart("m",Date()) Or (DatePart("m",Date())+1)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:45
Joined
May 7, 2009
Messages
19,246
see this sample db.
 

Attachments

  • birthday.zip
    26 KB · Views: 58

giddyhead

Registered User.
Local time
Today, 02:45
Joined
Jul 3, 2014
Messages
88
Thanks for the file. Have a question how might the code be modify to show the names like:
Well, Joe
Friend, My

In a Textbox. Thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:45
Joined
May 7, 2009
Messages
19,246
replace the function in the Module with this one:
Code:
Public Function fnConcatCelebrant(department As String) As String
    Dim strVariable As String
    Dim nPos As Integer
    With CurrentDb.OpenRecordset( _
            "select Names From qryBDCelebrantThisMonthAndNextMonth where " & _
            "Dept = " & Chr(34) & department & Chr(34), dbOpenSnapshot)
        If Not (.BOF And .EOF) Then .MoveFirst
        While Not .EOF
            strVariable = strVariable & vbCrLf & .Fields(0)
            .MoveNext
        Wend
    End With
    If strVariable <> "" Then
        strVariable = Mid(strVariable, 3)
    End If
    fnConcatCelebrant = strVariable
End Function
 

giddyhead

Registered User.
Local time
Today, 02:45
Joined
Jul 3, 2014
Messages
88
Outstanding! Thanks it works great. Thank you for your time and effort.
 

Users who are viewing this thread

Top Bottom