I have the following code:
Private Sub Employee_AfterUpdate()
ctYear1.ClearDays
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Dim rst As DAO.Recordset
Dim Image As String
Set db = CurrentDb
Set qdf = db.QueryDefs("EmployeeAbsenceYear"
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rst = qdf.OpenRecordset(dbOpenDynaset).Clone
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
rst.MoveNext
Loop
End If
End If
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
Select Case Image
Case 1
Me.ctYear1.DateBackColor = RGB(0, 0, 160)
Case 2
Me.ctYear1.DateBackColor = RGB(121, 121, 255)
Case 3
Me.ctYear1.DateBackColor = RGB(185, 185, 255)
Case 4
Me.ctYear1.DateBackColor = RGB(0, 0, 160)
Case Else
Me.ctYear1.SelectBackColor = RGB(0, 0, 0)
End Select
End Sub
-------------------
Problem is that I don't think that my Case Select Statement is working. I do not receive any error messages, but only the Case Else line changes.
Basically, I have this query, and in this query is a number field called "Image" For each image, I want to assign it a number and this number then changes the background colour.
Thank you
Private Sub Employee_AfterUpdate()
ctYear1.ClearDays
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Dim rst As DAO.Recordset
Dim Image As String
Set db = CurrentDb
Set qdf = db.QueryDefs("EmployeeAbsenceYear"
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rst = qdf.OpenRecordset(dbOpenDynaset).Clone
If Not ErrorCondition Then
m_bFoundFile = True
Else
m_bFoundFile = False
End If
If m_bFoundFile Then
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
HoldDate = rst!Date
rst.MoveNext
Loop
End If
End If
DBErrorHandler:
'MsgBox " Database not Found!"
ErrorCondition = True
Select Case Image
Case 1
Me.ctYear1.DateBackColor = RGB(0, 0, 160)
Case 2
Me.ctYear1.DateBackColor = RGB(121, 121, 255)
Case 3
Me.ctYear1.DateBackColor = RGB(185, 185, 255)
Case 4
Me.ctYear1.DateBackColor = RGB(0, 0, 160)
Case Else
Me.ctYear1.SelectBackColor = RGB(0, 0, 0)
End Select
End Sub
-------------------
Problem is that I don't think that my Case Select Statement is working. I do not receive any error messages, but only the Case Else line changes.
Basically, I have this query, and in this query is a number field called "Image" For each image, I want to assign it a number and this number then changes the background colour.
Thank you