roma126
Дата: 19.12.2011 09:39:36
Помогите, пожалуйста, дописать 2 пункт поиска, где нужно сформировать по значениям полей даты от date_f по date_f1. Заранее спасибо!
Dim strActiveControlName As String
Dim strSql As String
Dim strWhere As String
strActiveControlName = Screen.ActiveControl.Name
strWhere = "WHERE True "
'1- формирую поиск по номеру
If strActiveControlName = "nom_f" Then
If Len(Me!nom_f.text & "") > 0 Then
strWhere = strWhere & "And numer Like '" & Me!nom_f.text & "*' "
End If
Else
If Len(Me!nom_f.Value & "") > 0 Then
strWhere = strWhere & "And numer Like '" & Me!nom_f.Value & "*' "
End If
End If
'2- формирую поиск по дате
If strActiveControlName = "date_f" Then
If (Me.date_f.text & Me.date_f1.text)>0 Then
strWhere=strWhere & "And date between '"& me!date_f.Text" and "me!date_f1.Text" '"
End If
' все сформированные объекты фильтруют таблицу
strSql = "SELECT * FROM [gryvchod] " & strWhere & ";"
Me.RecordSource = strSql
Me.Requery
End Sub