0
我是VBA的新手,需要獲取幫助才能獲得工作指令。我需要查看2個值,並在按下按鈕時創建新記錄。我對dlookup有問題。基本的VBA代碼(dlookup)
Private Sub Add_Record_Click()
Dim db As Database
Dim r As Recordset
Dim x As Integer
Set db = CurrentDb
Set r = db.OpenRecordset("Copy Of Employee Work Statistics")
Y = r.Fields("School")
z = r.Fields("School Id")
Y = DLookup(Table![Routes].School, Table![Routes], "Route" = Table![Routes].[Route Name])
z = DLookup("school ID", "Customer Database", "school" = Y)
r.Update
DoCmd.GoToRecord , , acNewRec
End Sub