Push button, display error dialogue

Creating and using forms
Post Reply
dianamon
Posts: 3
Joined: Thu Jun 16, 2016 7:16 pm

Push button, display error dialogue

Post by dianamon »

Hello!

Pretty new to openoffice- But I'm trying my best on a simple form to add customers into a database.
Everything works fine as it is now- But my workmates will have to use it as well and they're not very computer savvy.
Is there a way for my Push Button to open a dialogue box after it Saves and opens a new record?
It would be great if it could open a dialogue stating 'Customer added to database' . Even better if it could pick up on a Duplicate error or information not completed.
Right now there's no 'Violation of Unique record' message if you try and enter a duplicate record via the push button...

Any help is very welcome! Struggling with this for a bit too long now..
open office 4.1.2 windows 10
dianamon
Posts: 3
Joined: Thu Jun 16, 2016 7:16 pm

Re: Push button, display error dialogue

Post by dianamon »

I managed to get a message to come up when a customer is added to the database.
(while waiting for the topic to be approved :shock: ) Found this code in another topic and tweaked it:

Code: Select all

Sub helper
Const Helpheader="Added to Database"
Const Helptext= "You successfully added a new customer to the database!" 
Const OKbuttonOnly=0

MsgBox Helptext, OKbuttonOnly, Helpheader

End Sub
]
The only problem is displaying the 'Violation of Unique record' message...
open office 4.1.2 windows 10
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Push button, display error dialogue

Post by UnklDonald418 »

I suspect you haven't received any responses to your question because it is a little too vague for anyone to offer much help.
Right now there's no 'Violation of Unique record' message if you try and enter a duplicate record via the push button.

Code: Select all

MsgBox ("Violation of Unique record",0,"Error")
can be used to display the message, but I'm guessing your problem involves trapping the error.
If that's the case perhaps if you uploaded a sample database file someone might be able to offer better help.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Push button, display error dialogue

Post by Villeroy »

Like so often, there is a way to do it if you leave behind the embedded HSQL1.8
viewtopic.php?f=61&t=68434&p=306909&hil ... ed#p331154
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
dianamon
Posts: 3
Joined: Thu Jun 16, 2016 7:16 pm

Re: Push button, display error dialogue

Post by dianamon »

Thanks! I'll give it a go from the link you gave me.
The difficult part is that although everything in the database works fine right now, my workmates just don't understand openoffice at all... I'm trying to make it as user friendly as I can!
open office 4.1.2 windows 10
Post Reply