[Solved] Problem with DLookup (Access2Base) in MySQL

Discussions about using 3rd party extension with OpenOffice.org

[Solved] Problem with DLookup (Access2Base) in MySQL

Postby inizul » Sat Aug 20, 2016 10:10 pm

When I execute de following code:

Code: Select all   Expand viewCollapse view
Sub IPF_ActualizarDenominacionComponente ()
  Dim sCodigo as string
  Dim sDenominacion as string
 
  sCodigo=getValue("Forms!InformePreserieFicha!codigo")
  sDenominacion=Application.DLookup("[Denominacion]", "[piezas]","[Codigo]='" & scodigo & "'")
  '             [Application.]DLookup(expression,       domain           [, criteria]             [, orderclause]))
  setValue("Forms!InformePreserieFicha!Componente.Value", sDenominacion)
End Sub


The program ABORT (see atached image):

Code: Select all   Expand viewCollapse view
SQL=SELECT TOP1 'Denominacion' AS 'TEMP48341' FROM 'piezas' WHERE 'Codigo'='K57M411200'


Is the SQL query correct? Or am I doing something wrong?

Database type: MySQL (JDBC) 5.7.11 x86
Database Engine: MyISAM
Server: 5.7.11 - MySQL Community Server (GPL)
LibreOffice: 5.1.4.2
Attachments
abort_dLookup.png
Last edited by Hagar Delest on Sun Aug 28, 2016 4:15 pm, edited 2 times in total.
Reason: tagged [Solved].
LibOffice 5.1.4.2 on Windows 7
inizul
 
Posts: 8
Joined: Sat Aug 20, 2016 5:46 pm

Re: Problem with DLookup (Access2Base) in MySQL

Postby inizul » Sat Aug 20, 2016 10:46 pm

But this code work well

Code: Select all   Expand viewCollapse view
Sub ActualizarDenominacionComponente()
' Busca en la tabla de piezas la denominación a partir del código
' Ejecuta: la actualización del registro
  Dim sCodigo as string
  Dim sDenominacion as string
  Dim oCodigo as Object
  Dim oFormulario as object
  Dim oControl
  Dim oRecordset as object

  set oFormulario=Forms("InformePreserieFicha")
  set oControl=oFormulario.Controls("codigo")
  sCodigo=oControl.Value
  Set oRecordset = Application.CurrentDb().OpenRecordset("SELECT [Denominacion] FROM [piezas] WHERE [Codigo]='" & sCodigo &"'")
  'msgbox "RecordCount: " & oRecordset.RecordCount
  sDenominacion=oRecordset.Fields(0).Value
  set oControl=oFormulario.Controls("Componente")
  oControl.Value= sDenominacion
  oRecordset.mClose
End sub
...
LibOffice 5.1.4.2 on Windows 7
inizul
 
Posts: 8
Joined: Sat Aug 20, 2016 5:46 pm

Re: Problem with DLookup (Access2Base) in MySQL

Postby JPL » Mon Aug 22, 2016 12:51 pm

Hi Inizul,

indeed there is a bug in Access2Base/LO 5.1 caused by the fact that MySQL does not recognize the "SELECT TOP 1" syntax as HSQLDB does.

It has been corrected in LO 5.2 after its mention HERE.

Thanks.
JPL
Windows 7 / LibO 6.0 / AOO 4.1
Ubuntu 18.04 / LibO 6.1
Access2Base extension (AOO) or standard (LibO).
BaseDocumenter extension (LibO)
Documentation on http://www.access2base.com and http://www.access2base.com/basedocumenter
JPL
Volunteer
 
Posts: 103
Joined: Fri Mar 30, 2012 3:14 pm

Re: Problem with DLookup (Access2Base) in MySQL

Postby inizul » Mon Aug 22, 2016 5:42 pm

Ups!!

Sorry for not correctly read the documentation :oops:

JPL: Thanks for the clarification.
LibOffice 5.1.4.2 on Windows 7
inizul
 
Posts: 8
Joined: Sat Aug 20, 2016 5:46 pm


Return to Extensions

Who is online

Users browsing this forum: No registered users and 2 guests