List 6-26 Business.CustomerコンポーネントのUpdateCustomer_BILLDAYメソッド
1: Public Sub UpdateCustomer_BILLDAY(ByVal ID As Long, _
ByVal BILLDAY As Variant)
2: ' 顧客情報テーブル内の指定された顧客番号の顧客の締め日を変更する
3: ' 【引数】
4: ' ID = 変更したい顧客を特定する顧客番号を指定する
5: ' BILLDAY = 設定する締め日
6: ' 【戻り値】
7: ' なし
8: Dim objContext As ObjectContext
9: Dim objDataCustomer As DataObj.Customer
10:
11: ' オブジェクトコンテキストの取得
12: Set objContext = GetObjectContext()
13:
14: ' エラーハンドラの設定
15: On Error GoTo ErrHandle
16:
17: ' DataObj.Customerコンポーネントの実体化
18: Set objDataCustomer = CreateObject("DataObj.Customer")
19:
20: ' 対象となる顧客が削除ずみでないかどうかの確認
21: If objDataCustomer.IsDeleted(ID) <> ID_Exists Then
22: ' 削除済みもしくは存在しない
23: Err.Raise DataObj.Err_NotFound, App.Title, _
"指定された顧客番号をもつ顧客が見つかりません"
24: End If
25:
26: ' 顧客情報の設定
27: objDataCustomer.UpdateRecord_BILLDAY ID, BILLDAY
28:
29: ' DataObj.Customerの解放
30: Set objDataCustomer = Nothing
31:
32: ' コミットする
33: objContext.SetComplete
34:
35: ' オブジェクトコンテキストの解放
36: Set objContext = Nothing
37:
38: Exit Sub
39:
40: ErrHandle:
41: ' エラーハンドラ
42: objContext.SetAbort
43: Set objContext = Nothing
44: Set objDataCustomer = Nothing
45:
46: ' エラーの再発行
47: Err.Raise Err.Number, Err.Source, Err.Description, _
Err.HelpFile, Err.HelpContext
48: End Sub