|
我是在ADP中的视图中复制的SQL语句。如下:
Private Sub MaterialID_AfterUpdate()
Dim sqlstr As String, str1 As String
sqlstr = "SELECT Supplier.SupplierName,Material.MaterialCode,Material.MaterialName," & _
"MaterialPrice.Price,MaterialPrice.JieKuan" & _
"FROM Supplier INNER JOIN MaterialPrice ON Supplier.SupplierId = MaterialPrice.MaterialID" & _
"INNER JOIN Material ON MaterialPrice.MaterialID = Material.MaterialID" & _
"where MaterialID=" & Me.MaterialID & ""
Set cnn1 = CurrentProject.Connection
rs1.Open sqlstr, cnn1, adOpenKeyset, adLockPessimistic
If rs1.RecordCount > 0 Then
str1 = rs1.Fields(2) & rs1.Fields(0) & rs1.Fields(3) & ";" & str1
Me.desclist.RowSource = str1
End If
Set rs1 = Nothing
End Sub
它总是说在FROM附近语法错误,请各位指点一二。谢谢! |
|