João serras-pereira
asked on
error 3061 expected 1 MS/ACCESS 2013
I am running a query using the following code:
Private Sub Form_Load()
Dim coreDB As DAO.Database
Dim T00_ControlTableSet As DAO.Recordset, _
Q32_DocumentoSelectSet As DAO.Recordset
Dim Q32_DocumentoSelectDef As QueryDef
Dim strPath As String, _
strCorename As String, _
strUserID As String, _
strUserName As String
Dim DocID As Integer
Set coreDB = CurrentDb
Set T00_ControlTableSet = coreDB.OpenRecordset("T00_ ControlTab le", dbOpenDynaset)
DocID = Forms![F91_LoggedUser]![Fl d_F91_DocI D_Current]
Me.Fld_F19_BaseDocID = DocID
strPath = Nz(Forms![F91_LoggedUser]! [F91_Desti nationPath Current], "")
strCoreID = Format(Forms![F91_LoggedUs er]![CoreI D], "0000")
strUserName = Forms![F91_LoggedUser]![Fl d_F91_Nome CompletoUt ilizador]
strUserID = Format(Forms![F91_LoggedUs er]![Curre ntUserID], "0000")
Call LogMe("F19 Documento \ Load ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ DocID: " & Me.Fld_F19_BaseDocID & " \ Path: " & strPath)
strCoreID = Forms![F91_LoggedUser]![Co reID]
' selecciona o registo correto
strSetSQL = "SELECT T25_DocsIpeme.T25_BaseDocI D AS Q32_DocID, "
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Titulo AS Q32_Titulo, "
strSetSQL = strSetSQL & "T25_DocsIpeme.Sumario AS Q32_Sumario, "
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Destina tionPathXM L AS Q32_PathXML, "
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Destina tionPath AS Q32_Path "
strSetSQL = strSetSQL & "FROM T25_DocsIpeme "
strSetSQL = strSetSQL & "WHERE (((T25_DocsIpeme.T25_BaseD ocID)= " _
& Me.Fld_F19_BaseDocID & ")); "
MsgBox strSetSQL
On Error GoTo ErrorHandle:
Set Q32_DocumentoSelectDef = coreDB.QueryDefs("Q32_Docu mentoSelec t")
Q32_DocumentoSelectDef.SQL = strSetSQL
Set Q30_DocumentoSelectSet = coreDB.OpenRecordset("Q32_ DocumentoS elect", dbOpenDynaset)
With Q30_DocumentoSelectSet
Me.Fld_F19_Sumario = .Q32_Sumario
Me.Fld_F19_Titulo = .Q32_Titulo
Forms![F91_LoggedUser]![F9 1_Destinat ionPathCur rent] = .Q32_Path
strPath = .Q32_Path
Call LogMe("F19 Documento \ Document Record ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ DocID: " & Me.Fld_F19_BaseDocID & " \ Path: " & strPath)
End With
Exit Sub
ErrorHandle:
'Problema no Query (vazio?)
strError = Err & ": " & Error(Err)
Call LogMe("F19 Documento \ DblClick \ ERROR \ " & strError & " \ ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ File: " & strPath)
MsgBox "Problema no acesso ao Documento; Possívelmente não existe em arquivo"
Resume Next
End Sub
the query runs into the 3061 error:
I have checked the table names and they look alright!
Can anyone help?
Private Sub Form_Load()
Dim coreDB As DAO.Database
Dim T00_ControlTableSet As DAO.Recordset, _
Q32_DocumentoSelectSet As DAO.Recordset
Dim Q32_DocumentoSelectDef As QueryDef
Dim strPath As String, _
strCorename As String, _
strUserID As String, _
strUserName As String
Dim DocID As Integer
Set coreDB = CurrentDb
Set T00_ControlTableSet = coreDB.OpenRecordset("T00_
DocID = Forms![F91_LoggedUser]![Fl
Me.Fld_F19_BaseDocID = DocID
strPath = Nz(Forms![F91_LoggedUser]!
strCoreID = Format(Forms![F91_LoggedUs
strUserName = Forms![F91_LoggedUser]![Fl
strUserID = Format(Forms![F91_LoggedUs
Call LogMe("F19 Documento \ Load ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ DocID: " & Me.Fld_F19_BaseDocID & " \ Path: " & strPath)
strCoreID = Forms![F91_LoggedUser]![Co
' selecciona o registo correto
strSetSQL = "SELECT T25_DocsIpeme.T25_BaseDocI
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Titulo AS Q32_Titulo, "
strSetSQL = strSetSQL & "T25_DocsIpeme.Sumario AS Q32_Sumario, "
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Destina
strSetSQL = strSetSQL & "T25_DocsIpeme.T25_Destina
strSetSQL = strSetSQL & "FROM T25_DocsIpeme "
strSetSQL = strSetSQL & "WHERE (((T25_DocsIpeme.T25_BaseD
& Me.Fld_F19_BaseDocID & ")); "
MsgBox strSetSQL
On Error GoTo ErrorHandle:
Set Q32_DocumentoSelectDef = coreDB.QueryDefs("Q32_Docu
Q32_DocumentoSelectDef.SQL
Set Q30_DocumentoSelectSet = coreDB.OpenRecordset("Q32_
With Q30_DocumentoSelectSet
Me.Fld_F19_Sumario = .Q32_Sumario
Me.Fld_F19_Titulo = .Q32_Titulo
Forms![F91_LoggedUser]![F9
strPath = .Q32_Path
Call LogMe("F19 Documento \ Document Record ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ DocID: " & Me.Fld_F19_BaseDocID & " \ Path: " & strPath)
End With
Exit Sub
ErrorHandle:
'Problema no Query (vazio?)
strError = Err & ": " & Error(Err)
Call LogMe("F19 Documento \ DblClick \ ERROR \ " & strError & " \ ", "CORE :" & strCoreID & "\ User: " & strUserID & "\" & strUserName _
& " \ File: " & strPath)
MsgBox "Problema no acesso ao Documento; Possívelmente não existe em arquivo"
Resume Next
End Sub
the query runs into the 3061 error:
I have checked the table names and they look alright!
Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
gee ... THANKS!
GHot the problem; actually it was a name of a column.... btw how do I accede/inspect to the contents of a string in runtime without using the msgbox?
GHot the problem; actually it was a name of a column.... btw how do I accede/inspect to the contents of a string in runtime without using the msgbox?
<<btw how do I accede/inspect to the contents of a string in runtime without using the msgbox? >>
Put a break point on the line and then hit F8 to step through it or place a stop right after. Then you can either:
a. Hover over the variable and get the tool tip
b. Bring up the debug window (Ctrl/G) and type:
? <variable>
so
? strSQL
I do it this way so you can see the full thing (don't always get that with a hover).
? is short for Debug.Print
Jim.
Put a break point on the line and then hit F8 to step through it or place a stop right after. Then you can either:
a. Hover over the variable and get the tool tip
b. Bring up the debug window (Ctrl/G) and type:
? <variable>
so
? strSQL
I do it this way so you can see the full thing (don't always get that with a hover).
? is short for Debug.Print
Jim.
ASKER
Thanks!
joao
joao
Set Q30_DocumentoSelectSet = coreDB.OpenRecordset("Q32_
/gustav