|
If txt処理区分.Text = "2" Then
' レコード存在の再チェック
If objRs.EOF Then
MsgBox ("データが存在しません")
objRs.Close
Set objRs = Nothing
UpdateData = False
Exit Function
End If
' キーのセット
objRs.Fields("コード").Value = txtコード.Text
' 名前
objRs.Fields("名前").Value = txt名前.Text
' 学年
objRs.Fields("学年").Value = txt学年.Text
' 誕生日
If Trim(txt誕生日) = "" Then
objRs.Fields("誕生日").Value = Null
Else
objRs.Fields("誕生日").Value = _
Left(txt誕生日.Text, 4) & "/" & _
Mid(txt誕生日.Text, 6, 2) & "/" & _
Right(txt誕生日.Text, 2)
End If
' 電話番号
If Trim(txt電話番号) = "" Then
objRs.Fields("電話番号").Value = Null
Else
objRs.Fields("電話番号").Value = txt電話番号.Text
End If
' レコードの更新
objRs.Update
End If
| |