返回列表 上一主題 發帖

[發問] access 資料自動帶入

[發問] access 資料自動帶入



是否能說明為何這麼設計,品名代碼一般都是用數字,為何用中文

TOP

回復 5# a810328


可以在表單中設定 資料來源類型為資料表/查詢.. 資料來源選擇你要顯示的資料

TOP

me.品名代碼=Dlookup([品名],"品名代碼","[代碼]='" & left(me.型號,3) & "'")

TOP

請教一下如果是用2010版的也可以這樣輸入嗎?

TOP

在型號欄位的AfterUpdate事件, 撰寫程式.
大約如下: (使用DAO)
dim str_Num as string
str_Num = left(me.型號,3)
dim rs as recordset
set rs = currentdb.openrecordset("Select  品名 from 品名代碼 Where 代碼 = '" & str_Num & "'", dbopensnapshot)
if rs.recordcount <> 0 then
  me.品名代碼 = rs("品名")
end if

以上程式, 參考看看.

TOP

        靜思自在 : 虛空有盡.我願無窮,發願容易行願難。
返回列表 上一主題