# Revision history [back]

### use macro to autofill field

Hello all,

I am trying to autofill a field in a form while adding data.

In my table I have the following field names: First name Last name second person second first name second last name

While adding data to my table using a form, I would like the form to autofill the "second person" field with a standard value of "and".

The end result would be: first name last name and second first name second last name

I then want to use this data to print labels for sending mail.

searching for solutions I encountered something like:

sub add_second_person (PysEvent)
if PysEvent.Source.text <> "" then  PysEvent.Source.getByName("txtSecond Person") = "and"
end sub


Of course this does not work at all :P I know I have to define the getByName as a variable. Unfortunatly I don't know how.

I have been reading the LibreOffice macro manual. But still no idea of how to pull this off.

Hope anyone can help me with this.

Many thanks in advance.

Tinus087