List 7-79 FormProductフォームのBTN_CALC_Clickプロシージャ
1: Private Sub BTN_CALC_Click()
2: ' [計算]ボタンが押されたときの処理
3: Dim objProduct As Business.Product
4: Dim num As Long
5: Dim dt As Variant
6:
7: If Not IsNumeric(TXT_NUM.Text) Then
8: MsgBox "入力された数量が不正です"
9: Exit Sub
10: End If
11:
12: num = CLng(TXT_NUM.Text)
13:
14: On Error GoTo ErrHandle
15:
16: Set objProduct = CreateObject("Business.Product")
17:
18: dt = objProduct.GetReadyDate_Product(g_ProductID, num)
19:
20: Set objProduct = Nothing
21:
22: If IsNull(dt) Then
23: TXT_DATE.Text = "入庫予定にそれだけの数量の予定はありません"
24: Else
25: TXT_DATE.Text = FormatDateTime(dt, vbShortDate) & _
"に指定された数量が揃います"
26: End If
27:
28: Exit Sub
29:
30: ErrHandle:
31: ' エラーハンドラ
32: MsgBox Err.Description, vbOKOnly, "在庫の調査"
33: Set objProduct = Nothing
34: End Sub