|
▼クロ さん:
>ただし、開く時のイベントでレコードソースをセットしているかもしれない
>ですが。コードを提示できますか?
>あと、「Implement_Date」ってどこかのフィールド名ですよね?
これが出ました。
わたしはまず日付を表出させてみようと思っただけなのですが。
わたしのF_xxはF_Searchの複製でなくF_Searchのサブフォームの複製だったんですかね?
Private Sub Form_Open(Cancel As Integer)
Dim strCriteria As String
Dim Today
Today = Now
strCriteria = "SELECT tbl_UNIT.*, tbl_STAFF.*, tbl_CATEGORY.*, tbl_TRAINING.*, tbl_COURSE.*, tbl_STAFF_COURSE.* " & _
"FROM tbl_UNIT, tbl_CATEGORY, tbl_TRAINING, tbl_STAFF, tbl_COURSE, tbl_STAFF_COURSE " & _
"WHERE tbl_UNIT.Unit_ID = [tbl_STAFF].[Attached_Unit_Num] And tbl_CATEGORY.Category_ID = [tbl_TRAINING].[Attached_Category_Num] " & _
"And tbl_COURSE.COURSE_ID = [tbl_STAFF_COURSE].[COURSE_NUM] And tbl_STAFF.Staff_ID = [tbl_STAFF_COURSE].[Staff_NUM] " & _
"And tbl_TRAINING.Program_ID = [tbl_COURSE].[Training_Num] And tbl_UNIT.Unit_Status = 'valid' And tbl_STAFF.Staff_Status = 'valid' " & _
"And tbl_TRAINING.Program_Status = 'valid' And tbl_COURSE.Training_Status = 'valid' And tbl_CATEGORY.Category_Status = 'valid' "
If IsNull(Forms!F_Search!UnitName.Value) = False Then
strCriteria = strCriteria & " AND tbl_UNIT.Unit_Name = '" & Forms!F_Search![UnitName] & "' "
End If
If IsNull(Forms!F_Search!StaffName.Value) = False Then
strCriteria = strCriteria & " AND tbl_STAFF.Staff_Name = '" & Forms!F_Search![StaffName] & "' "
End If
If IsNull(Forms!F_Search!Category.Value) = False Then
strCriteria = strCriteria & " AND tbl_CATEGORY.Category_Name = '" & Forms!F_Search![Category] & "' "
End If
If IsNull(Forms!F_Search!PgmName.Value) = False Then
strCriteria = strCriteria & " AND tbl_Training.Program_Name = '" & Forms!F_Search![PgmName] & "' "
End If
strCriteria = strCriteria & " Order by "
Select Case Forms!F_Search!Order.Value
Case 1
strCriteria = strCriteria & " tbl_UNIT.Unit_ID desc;"
Case 2
strCriteria = strCriteria & " tbl_STAFF.Staff_ID desc;"
Case 3
strCriteria = strCriteria & " tbl_CATEGORY.Category_ID desc; "
Case 4
strCriteria = strCriteria & " tbl_TRAINING.Program_ID desc;"
End Select
Me.RecordSource = strCriteria
End Sub
Implement_Dateは元々tbl_COURSEのフィールド名です。日付/時刻型です。
|
|