Op 02/02/2013 07:04, Yessica Brinkmann schreef:
Hello,
I wanted to ask if I can please help with this issue. Is that really need
to implement this functionality for my database. The macro has no errors
but UPDATE is not performed in the customer table. I do not know if you owe
the event in which I am putting my macro, event currently in the Mouse
button released Calculate Total button. Same should work if saldo_actual
field for a record is empty it?
do the sql statement works when run from elsewhere (make a query to test)
I also see that all new users first make an introduction, I'm doing my
thesis on Computer Engineering and I am working Independent, as do
systems. I have more experience working on Java and XML, but I think this
is a nice opportunity to learn Visual Basic.
My macro is now as follows:
Sub ActualizarSaldoVentas (Evento)
Dim oFrm As Object
Dim oCliente As Object
Dim oTotal As Object
Dim oCon As Object
Dim oStat As Object
Dim sSQL As String
Dim oRes As Object
Dim rs As Object
Dim sCliente as String
Dim ColIndex as Integer
'Dim oIdPago As Object
oFrm=Evento.Source.Model.Parent
If oFrm.hasByName("id_cliente") Then
oCliente=oFrm.getByName("id_cliente")
Else
Print "Cannot find id_cliente"
Exit Sub
End If
rs=oFrm.createResultSet()
sCliente=rs.getString(rs.findColumn("cod_cliente"))
oTotal=oFrm.getByName("fmttotal")
Print sCliente
Print oTotal.getCurrentValue()
oCon=ThisDatabaseDocument.CurrentController.ActiveConnection
oStat=oCon.CreateStatement
sSQL = "UPDATE ""cliente"" " & "SET ""cliente"".""saldo_actual"" =" & "
""cliente"".""saldo_actual"" + " & oTotal.getCurrentValue() & " WHERE
""cliente"".""id_cliente""=" & CInt(sCliente)
oRes=oStat.ExecuteQuery(sSQL)
End Sub
Regards,
Yessica
2013/2/1 Yessica Brinkmann <yessica.brinkm...@gmail.com>
Hello,
I think maybe I should assign my macro to another event, perhaps one
associated with the form to work, I do not know, my idea is just. Tempted
now assigned to mouse button released event of a button called Calculate
Total.
regards,
Yessica
2013/2/1 Yessica Brinkmann <yessica.brinkm...@gmail.com>
Hello,
Thank you very much for the reply. Sorry, did not know that I should not
put attachments. Now I have no errors in the macro, and I used the SQL
UPDATE indicated. Just do not know why but UPDATE fails. So, when I check
the table, I do not see the value of the changed field. I refreshed the
table also but nothing. I printed the total value also to see if I was
right and good. I do not know what is going wrong.
Regards,
Yessica
2013/2/1 Fernand Vanrie <s...@pmgroup.be>
Ariel, Yessica,
with OObase database, table and field names are case sensitive, their is
no need to quote if: tables are lowercase and fieldnames uppercase.
if quotes are used, then leave the dots out of the quotes
sSQL= "SELECT ""mybase"".""cliente"".""**saldo_saldo_actual""
WHERE...................." works
greetz
Fernand
On Thu, Jan 31, 2013 at 08:01:22PM -0300, Yessica Brinkmann wrote:
Hi, thanks for your answer.
Now I advanced.
I print the value of the client code correctly.
Only now I have another error, tells me that the Customer table does
not
exist or something like this:
Basic runtime error. There was an exception. Type:
com.sun.star.sdbc.**SQLException. Message: Table not found in
statement
This may need to quote table and fields names:
sSQL="UPDATE cliente SET cliente.saldo_actual =
cliente.saldo_saldo_actual + "& oTotal.getCurrentValue()& " WHERE
cliente.id_cliente=" & CInt(sCliente)
What is the name of the table? "CLIENTES" or "clientes"?
Regards