teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

マークダウン記法に変更しました。勉強になりました、ご指摘ありがとうございます。

2019/09/27 00:55

投稿

m.trsk
m.trsk

スコア7

title CHANGED
File without changes
body CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
  以下が見よう見まねで書いたコードです。
13
13
 
14
+ ```VBA
15
+
14
16
  Dim db As DAO.Database
15
17
  Dim rs As DAO.Recordset
16
18
  Dim fld As DAO.Field
@@ -21,18 +23,18 @@
21
23
 
22
24
  '各フィールドプロパティ書き換え
23
25
  For Each fld In rs.Fields
24
- With fld
26
+ With fld
25
- ’データ型が数値であれば
27
+ ’データ型が数値であれば
26
- If .Type = dbInteger Then
28
+ If .Type = dbInteger Then
27
- '書式を「標準」、小数点を第3位に設定
29
+ '書式を「標準」、小数点を第3位に設定
28
30
  Set prp = .CreateProperty("Format", dbDecimal, "Standard")
29
31
  Set prp = .CreateProperty("DcimalPlaces", dbDecimal, 3)
30
- EndIf
31
- .Properties.Append prp
32
+ .Properties.Append prp
32
- End If
33
+ End If
33
- End With
34
+ End With
34
- Next・・・・・・・
35
+ Next
35
36
 
37
+ ```
36
38
  ### 発生している問題・エラーメッセージ
37
39
  エラーメッセージ
38
40
  「データ型が変換できない」と怒られます。
@@ -43,10 +45,12 @@
43
45
  ### 該当のソースコード
44
46
  下記2行目です。
45
47
 
48
+ ```VBA
46
49
  If .Type = dbDouble Then
47
- Set prp = .CreateProperty("Format", dbDecimal, "Standard")
50
+ Set prp = .CreateProperty("Format", dbDecimal, "Standard")
48
- Set prp = .CreateProperty("DcimalPlaces", dbDecimal, 3)
51
+ Set prp = .CreateProperty("DcimalPlaces", dbDecimal, 3)
49
52
  EndIf
53
+ ```
50
54
 
51
55
 
52
56
  ### 試したこと