Hi all,
First post here and very new to VBA so apologies in advance! I've tried searching on Google and also here and couldn't find much.
I have created a calendar using MS Access and VBA. I'm trying to get it to display holidays and what shift the person is on. My code almost works correctly...
Issue im having is that it displays the autonumber from the combo box. I've set the colums widths etc, and to view my tables and query it does display the name correctly.
"Fullname" is the name of the the fieldname that is displaying the number.
First post here and very new to VBA so apologies in advance! I've tried searching on Google and also here and couldn't find much.
I have created a calendar using MS Access and VBA. I'm trying to get it to display holidays and what shift the person is on. My code almost works correctly...
Issue im having is that it displays the autonumber from the combo box. I've set the colums widths etc, and to view my tables and query it does display the name correctly.
"Fullname" is the name of the the fieldname that is displaying the number.
Code:
Sub DisplayBirthdaylist(dselectdate As Date, lcontrol As Control) ' This is the popup when cal dates are clicked
Dim rst As Recordset
Dim sql As String
Dim sList As String
sql = "select * from qryHolidays where Holday=" & Format(dselectdate, "dd") _
& " and HolMonth=" & Format(dselectdate, "mm") & ";"
Set rs = CurrentDb.OpenRecordset(sql)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
sList = sList & rs!Fullname & " - " & rs![Shift?] & vbCrLf
rs.MoveNext
Loop
End If
Set rs = Nothing
lcontrol.Caption = sList