0
我得到一個「自動化錯誤」就行rstLgn_details.Open SqlCmd
Excel自動化錯誤
這是代碼。
Call ConnectSS_Param(ThisWorkbook.FullName)
Set rstLgn_details = CreateObject("ADODB.Recordset")
Set SqlCmd = CreateObject("ADODB.Command")
Set SqlparamUserID = SqlCmd.CreateParameter("@UserID", 129, 1, 52, txtUsername.Value)
StrSql = "SELECT Capabilityname,SLAA_EID FORM $Login_Details WHERE [email protected]"
SqlCmd.ActiveConnection = conndb
SqlCmd.CommandText = StrSql
SqlCmd.Parameters.Append SqlparamUserID
rstLgn_details.Open SqlCmd
If rstLgn_details.RecordCount > 0 Then
UserName = rstLgn_details(1)
CapHlded = rstLgn_details(0)
ThisWorkbook.Sheets("Serach").Select
Else
MsgBox "Sorry You are Not Authorized for this..... ", vbInformation + vbOKOnly, "Invaild User"
End If
對於一件事你有FORM而不是'FROM'。 –