Hi:各位老師
我是一位剛學ACCESS 的,請哪位老師抽點時間幫我看一下代友碼,關鍵是"I"定義及取值位置,我沒有弄懂.
Private Sub Command10_Click()
On Error GoTo Err_command10_Click
Dim strWhere As String
Dim i As String
i = Me.Text48.Value
strWhere = ""
If Not IsNull(Me.Combo19) Then
strWhere = strWhere & "([PO_ID] like '*" & Me.Combo19 & "*') AND "
End If
If Not IsNull(Me.Combo30) Then
strWhere = strWhere & "([fty_ord] like '*" & Me.Combo30 & "*') AND "
End If
If Not IsNull(Me.Combo34) Then
strWhere = strWhere & "([fty] like '*" & Me.Combo34 & "*') AND "
End If
If Not IsNull(Me.Combo28) Then
strWhere = strWhere & "([line] like '*" & Me.Combo28 & "*') AND "
End If
If Not IsNull(Me.Combo32) Then
strWhere = strWhere & "([material_number] like '*" & Me.Combo32 & "*') AND "
End If
If Not IsNull(Me.Combo11) Then
strWhere = strWhere & "([EX_factory date] >=#" & Format(Me.Combo11, "yyyy/mm/dd") & "#) AND "
End If
If Not IsNull(Me.Combo13) Then
strWhere = strWhere & "([ex_factory date] <=#" & Format(Me.Combo13, "yyyy/mm/dd") & "#) AND "
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Me.fm_cgac_analyse_child.Form.Filter = strWhere
Me.fm_cgac_analyse_child.Form.FilterOn = True
Me.fm_cgac_analyse_child.Form.Requery
i = Me.Text48.Value
If i > 0.98 Then
Me.Text48.BackColor = 65280
ElseIf i > 0.95 And i < 0.98 Then
Me.Text48.BackColor = 8454143
Else
Me.Text48.BackColor = 255
End If
Exit_command10_Click:
Exit Sub
Err_command10_Click:
MsgBox Err.Description
Resume Exit_command10_Click
End Sub