回答編集履歴
3
コード修正
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
-
If Nz(Me!Text_Cost2, "")
|
61
|
+
If Nz(Me!Text_Cost2, "") <> "" Then
|
62
62
|
|
63
63
|
stFilter = stFilter & " and F_Cost <= " & Me.Text_Cost2
|
64
64
|
|
2
コード修正
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
If Nz(Me!Text_Cost, "") <> "" Then
|
10
10
|
|
11
|
-
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost >= Text_Cost
|
11
|
+
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost >= Me.Text_Cost
|
12
12
|
|
13
13
|
End If
|
14
14
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
If Nz(Me!Text_Cost2, "") = "" Then
|
18
18
|
|
19
|
-
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost <= Text_Cost2
|
19
|
+
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost <= " & Me.Text_Cost2
|
20
20
|
|
21
21
|
End If
|
22
22
|
|
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
If Nz(Me!Text_ProductCode, "") <> "" Then
|
42
42
|
|
43
|
-
stFilter = stFilter & "and F_ProductCode like '*" & Text_ProductCode & "*'"
|
43
|
+
stFilter = stFilter & " and F_ProductCode like '*" & Text_ProductCode & "*'"
|
44
44
|
|
45
45
|
End If
|
46
46
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
If Nz(Me!Text_Cost, "") <> "" Then
|
54
54
|
|
55
|
-
stFilter = stFilter & " and F_Cost >= Text_Cost
|
55
|
+
stFilter = stFilter & " and F_Cost >= " & Me.Text_Cost
|
56
56
|
|
57
57
|
End If
|
58
58
|
|
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
If Nz(Me!Text_Cost2, "") = "" Then
|
62
62
|
|
63
|
-
stFilter = stFilter & " and F_Cost <= Text_Cost2
|
63
|
+
stFilter = stFilter & " and F_Cost <= " & Me.Text_Cost2
|
64
64
|
|
65
65
|
End If
|
66
66
|
|
1
追記
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
If Nz(Me!Text_Cost, "") <> "" Then
|
10
10
|
|
11
|
-
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter
|
11
|
+
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost >= Text_Cost"
|
12
12
|
|
13
13
|
End If
|
14
14
|
|
@@ -16,8 +16,62 @@
|
|
16
16
|
|
17
17
|
If Nz(Me!Text_Cost2, "") = "" Then
|
18
18
|
|
19
|
-
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter
|
19
|
+
Me!Sub_ProductMaster.Form.Filter = Me!Sub_ProductMaster.Form.Filter & " and F_Cost <= Text_Cost2"
|
20
20
|
|
21
21
|
End If
|
22
22
|
|
23
23
|
```
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
`Me!Sub_ProductMaster.Form.Filter`が繰り返し登場するのは見苦しいし、遅くなりますので、
|
32
|
+
|
33
|
+
条件式は変数に格納しておいて、最後に`Filter`プロパティに設定するのがいいでしょう。
|
34
|
+
|
35
|
+
```vba
|
36
|
+
|
37
|
+
Dim stFilter As String
|
38
|
+
|
39
|
+
stFilter = "F_DeleteFlag = False "
|
40
|
+
|
41
|
+
If Nz(Me!Text_ProductCode, "") <> "" Then
|
42
|
+
|
43
|
+
stFilter = stFilter & "and F_ProductCode like '*" & Text_ProductCode & "*'"
|
44
|
+
|
45
|
+
End If
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
'中略
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
If Nz(Me!Text_Cost, "") <> "" Then
|
54
|
+
|
55
|
+
stFilter = stFilter & " and F_Cost >= Text_Cost"
|
56
|
+
|
57
|
+
End If
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
If Nz(Me!Text_Cost2, "") = "" Then
|
62
|
+
|
63
|
+
stFilter = stFilter & " and F_Cost <= Text_Cost2"
|
64
|
+
|
65
|
+
End If
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
With Me!Sub_ProductMaster.Form
|
70
|
+
|
71
|
+
.Filter = stFilter
|
72
|
+
|
73
|
+
.FilterOn = True
|
74
|
+
|
75
|
+
End With
|
76
|
+
|
77
|
+
```
|