method execute of object connection failed, ' |
Option Compare Database Option Explicit Private Sub Form_Open(Cancel As Integer) Dim intAutid As Integer Dim intGroupid As Integer intAutid = 66 intGroupid = 37 Dim strNum As String strNum = "SELECT tblAutopsy.num FROM tblAutopsy WHERE tblAutopsy.autopsyid=" & intAutid Me.fldNum.Value = CurrentProject.Connection.Execute(strNum).Fields(0) Dim strVid As String strVid = "SELECT tblVid.vid FROM tblVid RIGHT JOIN tblAutopsy ON " & _ "tblVid.id = tblAutopsy.vidida WHERE tblAutopsy.autopsyid=" & intAutid Me.fldVid.Value = CurrentProject.Connection.Execute(strVid).Fields(0) 'Dim strLocal As String 'strLocal = "SELECT tblGroups.localid FROM tblGroups WHERE tblGroups.groupsid=" & intGroupid 'Me.fldLocal.Value = CurrentProject.Connection.Execute(strLocal).Fields(0) Dim strLocal As String strLocal = "SELECT tblLocal.local FROM tblLocal RIGHT JOIN tblGroups ON " & _ "tblLocal.localid = tblGroups.localid WHERE tblGroups.groupsid=" & intGroupid Me.fldLocal.Value = CurrentProject.Connection.Execute(strLocal).Fields(0) Dim strGroup As String strGroup = "SELECT tblGruppa.gruppa FROM tblGruppa RIGHT JOIN tblGroups ON " & _ "tblGruppa.gruppaid = tblGroups.gruppaid WHERE tblGroups.groupsid=" & intGroupid Me.fldGroup.Value = CurrentProject.Connection.Execute(strGroup).Fields(0) End Sub
http://www.sql.ru/forum/1117254/method-execute-of-object-connection-failed-v-fak-e-byl