Ask Your Question

tinus087's profile - activity

2017-02-01 19:09:34 +0200 received badge  Famous Question (source)
2016-03-15 00:32:34 +0200 received badge  Notable Question (source)
2016-02-19 11:08:16 +0200 received badge  Popular Question (source)
2015-11-09 15:09:41 +0200 answered a question use macro to autofill field

figured it out.

the macro helped me do it. I'm not sure if this is the best way to do it but it works fine.

sub add_second_person

dim odoc as object
dim odrawpage as object
dim oform as object
dim osecond_person as object
dim osecond_first_name as object

odoc = thisComponent
odrawpage = odoc.drawpage
oform = odrawpage.forms.getByName("Main Form")
osecond_person = oform.GetByName("txtSecond Person")
osecond_first_name = oform.GetByName("txtSecond Firstname")

if osecond_first_name.text = "" then  osecond_person.text = "" else if osecond_first_name.text <> "" then osecond_person.text = "and"

end sub

It was a pain in the butt, but I finaly figured it out myself. Hope I can help everyone who has the same problem.

Kind regards,

tinus087

2015-11-06 14:46:36 +0200 marked best answer 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

2015-11-06 14:46:36 +0200 received badge  Scholar (source)
2014-10-30 16:11:02 +0200 received badge  Famous Question (source)
2013-11-19 11:05:58 +0200 commented question writer - Page Count & Number not exporting

are you saving it as word 95 .doc or as a word 97/2000/XP/2003 .doc?

2013-10-01 17:43:07 +0200 received badge  Popular Question (source)
2013-10-01 17:43:07 +0200 received badge  Notable Question (source)
2013-08-07 16:28:18 +0200 answered a question Base: Images in Reports

First you need to make a table with a cell that is capable of inserting pictures. 'Picture [LONGVARBINARY]'.

After that you need to make a form of this table for inserting records and a field for uploading pics.

Now go to reports and create a report for the table.

That's it

2013-08-06 08:30:57 +0200 received badge  Supporter (source)
2013-08-06 08:11:44 +0200 commented answer Can I prevent base from putting duplicates in a table?

good job on the link, very usefull. I already tested the VARCHAR_IGNORECASE the outcome was the same.

Tested it again with, you where right. The VARCHAR_IGNORECASE in combination with the SQL code ALTER TABLE "Customers" ADD UNIQUE ("CustomerID"); works perfect.

2013-08-05 16:08:47 +0200 answered a question Can I prevent base from putting duplicates in a table?

One way to do this is to make the 'Name' field the primary key. Only downside is that if you use a client ID or person ID you must fill it in yourself.

Please note that if you choose to use this, that the use of capital letters will matter. For example 'Smith' and 'smith' will create 2 different records in the database.

2013-08-02 08:18:55 +0200 received badge  Autobiographer
2013-08-01 17:58:54 +0200 received badge  Teacher (source)
2013-08-01 14:13:40 +0200 answered a question Closing down 3.4 completely to install 4.1

are you using windows or something else? If you are using windows, what version are you using?

2013-08-01 13:41:09 +0200 received badge  Editor (source)
2013-08-01 12:02:25 +0200 asked a question Close form + warn if record is unsaved using macro

Hello,

I am building a database and I'm using a switchboard. Opening a form is working with the macro I am using. But the problem is going back to the switchboard. The macro I'm using leaves the form open.

What I want the button to do is: 1. Check if there is an open, unsaved record and if so warn the user to safe his work 2. Close the form that is in use (name of the first form is GSM formulier) 3. Open the switchboard form (whitch is named Switchboard)

I am not sure if the closing and opening are in the right order or it is wiser to first open the switchboard and after that close the form ' GSM formulier' . What is your take on this?

the macro I am using for opening the form is:

Sub OpenSwitchboard
const sNewDocumentName="Switchboard" ' This opens the switchboard
oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
End Sub

I am not a programming superhero so any help is welcome.

Many thanks

Tinus087