Hello to everybody. I have a Search Form with two options as criteria. "Days" and "Works" of each day . Days is a combo box with the days of the week. Data of combo box are records of the Days Table . Although the days of Criteria Section appear as words, the results appear by the DayID of the the Day Table. How can I make them appear as words? Forgive my mistakes in English (I 'm from Greece). Thank you all. here is the code:
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.FilterDay) Then
strWhere = strWhere & "([DayID] = " & Me.FilterDay & ") AND "
End If
If Not IsNull(Me.FilterStreet) Then
strWhere = strWhere & "([Street] Like ""*" & Me.FilterStreet & "*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Insert kriteria", vbInformation, "Nothing to execute."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Exit_Click()
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You can't add data.", vbInformation, "Action rejected."
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub
Private Sub ExitForm_Click()
On Error GoTo Err_Exit_Click
DoCmd.Close
Exit_ExitForm_Click:
Exit Sub
Err_Exit_Click:
MsgBox Err.Description
Resume Exit_ExitForm_Click
End Sub