Hi, this must be simple but I can't find any documentation to do it. I want when I click on button on a form to open new record and go to a specific field on the form. Can I edit this to do that ( the field is called "Pattern Field Date":
sub new_record
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:NewRecord", "", 0, Array())
end sub
What kind of form is this? Is it bound to a database object (table, view or query)?
As you are talking of records I assume this is the case. If you create a button in the design mode you right click on it and choose "Control Properties". On the event tab page creating a new record is one of the suggested actions.
Search the Base forum for button, new record or something like that.
The macro recorder with its dispatcher calls won't help you with this. And in general one of the recommendations when working with Base is to avoid macros as long as possible.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Thank you for the reply! I already have the button on the form called"new" and when I click it it goes to a new blank record. I would then like it to put the cursor in the first field "date" so I can just click on "new" and then start entering data. Yes the form is bound to a table.
Learn first what you can do without macros and it seems to me it can be done whithout a macro.
Study all the properties of a button. One of then is getting focus on click.
For the form you can organize the tab-order for a simple form you can manage this maybe complete without any macro.
I thought this would be easy, apparently not as I can't find any info how to. I've got it working so that after I click on the "new" button I just hit the tab key and it goes to the first field. It would have been much better to do this just by clicking the "new" button.
There is a button on the toolbar for forms what organize the taborder maybe this can help you. When you want work with forms then you have to study all this kinds of details.
I cannot see your form. So I cannot say that you can do it without macros. But I think you must first learn what you can do with forms without macros. Maybe you have to redesign your form in a way that it can do what you want. Maybe you have to use not OOo but an other tool for making forms but I have no idea.