
Photo by
reo_for_irnmn
AccessVBAでコードの一致した製品の情報をテーブルからフォームのテキストボックスに格納する
Dim Cn As ADODB.Connection
Dim Re As ADODB.Recordset
Set Cn = CurrentProject.Connection
Set Re = Cn.Execute("T_製品マスタ")
Do Until Re.EOF
If (Re("製品コード") = txtBox_製品コード) Then
txtBox_製品名 = Re!製品名
txtBox_単価 = Re!単価
End
End If
Re.MoveNext
Loop
Re.Close
Set Re = Nothing
Cn.Close
Set Cn = Nothing