Hello,
I think I can do this with string functions Left and Split but I do not
know which is the separator for the ComboBox, for separating the code from
the name.
Much appreciate an answer please.
regards,
Yessica

2013/1/30 Yessica Brinkmann <yessica.brinkm...@gmail.com>

> Hello,
> Thank you for the answers!
> When I replaced the lines containing "getByName" for something as
> indicated prints a message saying: "Can not find cod_cliente". I think this
> is because it is a field cod_cliente type drop-down list box and i should
> get the id of the customer through a cut chain or something, but I really
> do not know how to do this in OO Basic. Can you help a little with this
> please? I clarify that my formal education rather relied on the C and Java.
> regards,
> Yessica
>
>
> 2013/1/30 Andrew Douglas Pitonyak <and...@pitonyak.org>
>
>> Which line gives the error?
>>
>> If you change all lines containing "getByName" with something like
>>
>> If oFrm.hasByName("cod_cliente") Then
>>   oCliente=oFrm.getByName("cod_**cliente")
>> Else
>>   Print "Cannot find cod_cliente"
>>   Exit Sub
>> End If
>>
>> What happens?
>>
>>
>> On 01/30/2013 04:56 AM, Yessica Brinkmann wrote:
>>
>>> Hello,
>>> I have a database of business management. I have a customer table that
>>> has
>>> a field saldo_actual.
>>> On the other hand, I have a sales form, in which I have a total field,
>>> and
>>> a button Calculate Total.
>>> I want to make a macro that when clicking on the Calculate Total button
>>> to
>>> add the total saldo_actual field.
>>> I assigned the macro to the button event: Mouse button released. Then I
>>> write my macro:
>>> 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 sCliente as String
>>> oFrm=Evento.Source.Model.**Parent
>>> oCliente=oFrm.getByName("cod_**cliente")
>>> sCliente=oCliente.**getCurrentValue()
>>> oTotal=oFrm.getByName("total")
>>> oCon=ThisDatabaseDocument.**CurrentController.**ActiveConnection
>>> oStat=oCon.CreateStatement
>>> sSQL="UPDATE cliente SET cliente.saldo_actual =
>>> cliente.saldo_saldo_actual
>>> + "& oTotal.getCurrentValue()& " WHERE id_cliente=" &
>>> oCliente.getCurrentValue()
>>> oRes=oStat.ExecuteQuery(sSQL)
>>> End Sub
>>> Clicking on the button Calculate total, I get the following error:
>>> BASIC runtime error. There was an exception.
>>> Type: com.sun.star.container.**NoSuchElementException Message:
>>> I would appreciate very much a help please.
>>> regards,
>>> Yessica
>>>
>>>
>> --
>> Andrew Pitonyak
>> My Macro Document: 
>> http://www.pitonyak.org/**AndrewMacro.odt<http://www.pitonyak.org/AndrewMacro.odt>
>> Info:  http://www.pitonyak.org/oo.php
>>
>>
>

Reply via email to