作者ychinglin (he)
看板Visual_Basic
标题[VBA ] 输入编号後 另一栏自动带入对应值
时间Tue Feb 23 11:25:52 2010
版本:office 2003
在2nd请购单内,有以下资料
请购单单号 物料编号
aa 11
bb 22
问题:
表单在执行程式的时候
输入aa之後 物料编号全部显示11
aa 11
bb 11
输入bb之後 物料编号全部显示22
aa 22
bb 22
要如何更改 变成
aa 11
bb 22
Private Sub 请购单单号_AfterUpdate()
Dim strsql As String
strsql = "select 物料编号 from 2nd请购单 where 请购单单号 = '" & Me![请购单单
号] & "'"
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open strsql, CurrentProject.Connection
If Not rst.BOF Then
Me![物料编号] = rst.GetString
End If
rst.Close
Set rst = Nothing
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.232.75.179
1F:→ ychinglin:解决 控制项来源没设定好>"< 03/12 13:03