toidjtjmtoi > 27-06-19, 10:32 AM
Trích dẫn:Syntax error in date in query expression '[vDate] = #29/2/2019# and [eid]=6'Code lỗi
Trích dẫn:Me("Day" & Trim®).Value = DLookup("[vHrs]", "tblVacHrs", "[vDate] = #" & intDay & "/" & intMonth & "/" & MyYear & "# And [eid]=" & empid)
Trích dẫn:Public Sub SetDates()
For r = 1 To 37
Me("Box" & Trim$®) = ""
Me("Box" & Trim®).BackColor = "16777215"
Me("Box" & Trim®).Visible = True
Me("Day" & Trim$®) = ""
Me("Day" & Trim®).BackColor = "16777215"
Next r
For r = 36 To 37
Me("Box" & Trim®).Visible = False
Me("Day" & Trim®).Visible = False
Next r
Box37.BackColor = "12632256"
Day37.BackColor = "12632256"
txtMonth.Caption = MonthName(intMonth) & " " & MyYear
intPos = InStr(1, Date, "/", vbTextCompare)
intFirstDay = WeekDay(Str(intMonth) & "/1" & Str(MyYear))
intDay = 1 - intFirstDay + 1
strDate = Str(intMonth) & "/1" & Str(MyYear)
intLastDay = DateSerial(Year(strDate), Month(strDate) + 1, Day(strDate)) _
- DateSerial(Year(strDate), Month(strDate), Day(strDate))
For r = 1 To 35
strDay = "Box" & Trim®
dv = "Day" & Trim®
If intDay < 1 Then
Me(strDay).BackColor = "12632256"
Me(strDay).Visible = False
Me("Day" & Trim®).BackColor = "12632256"
Else
If intDay >= intLastDay + 1 Then
Me(strDay).BackColor = "12632256"
Me(strDay).Visible = False
Me("Day" & Trim®).BackColor = "12632256"
Else
Me(strDay) = intDay
Me("Day" & Trim®).Value = DLookup("[vHrs]", "tblVacHrs", "[vDate] = #" & intDay & "/" & intMonth & "/" & MyYear & "# And [eid]=" & empid)
If Not IsNull(DLookup("[hDate]", "tblHolidays", "[hDate]=#" & intMonth & "/" & intDay & "/" & MyYear & "#")) Then
Me("Box" & Trim®).ForeColor = "8421504"
End If
End If
End If
intDay = intDay + 1
Next r
For r = 36 To 37
If intDay <= intLastDay Then
Me("Box" & Trim®) = intDay
Me("Box" & Trim®).Visible = True
Me("Box" & Trim®).BackColor = "16777215"
Me("Day" & Trim®).Visible = True
Me("Day" & Trim®).BackColor = "16777215"
Me("Day" & Trim®).Value = DLookup("[vHrs]", "tblVacHrs", "[vDate] = #" & intDay & "/" & intMonth & "/" & MyYear & "#")
End If
intDay = intDay + 1
Next r
If IsNull(DSum("[vHrs]", "tblVacHrs", "Month([vDate])=" & intMonth & " and Year([vDate])=" & MyYear & " And [eid]=" & empid)) Then
Me.txtTotal.Value = 0
Else
Me.txtTotal.Value = DSum("[vHrs]", "tblVacHrs", "Month([vDate])=" & intMonth & " and Year([vDate])=" & MyYear & " And [eid]=" & empid)
End If
End Sub
ongke0711 > 27-06-19, 10:56 AM
ongke0711 > 27-06-19, 02:06 PM
(27-06-19, 01:57 PM)toidjtjmtoi Đã viết: Không có nhưng làm sao sửa khi bị vậy bạn . Câu lệnh chỉ hiển thị lên 1 lịch có 31 ngày , cứ ngày nào chỉ có 30 là nó lỗi