Thank you very much. That was, what I need, now my Form works as expected.
Very best regards Emil Tchekov -----Ursprüngliche Nachricht----- Von: Andrew Douglas Pitonyak [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 14. Oktober 2005 03:25 An: [email protected] Betreff: Re: [users] Accessing Database Form Fields Emil Tchekov wrote: >Hi, > >I am new in the OO Macro Programming, but have good skills and experience in >VBA. >Now I am trying to change to Base (from M$ Access). >I was allready able to write some small makros in OO Basic (Dialogs, Events >etc.) > >But I was not able to find a way to get/set Properties in the DB Form (it is >Writer Document and not "standard" Dialog...) > >I want to generate Primary key from the user input (it is very easy in MS >Access). >As example: User inputs Name, Surname and Postal code -> event driven >Procedure gets with LEFT() the first x(=2 or 3) chars from name and surname >adds "-" and the Postal code - (so we get sth. like "EmTc-12345") and than >put this sting into the Primary Key field ... > > >So what I need is the way to read/write to the appropriate text fields in >the form... > >Does anybody can provide an example how to access a text field (and other >type of controls) in a db (oowriter) form? > > > >Thank you very much in advance > > >Best Regards > >Emil Tchekov > > > >P.S. Very usefull will be also to have a way to hide the navigation bar >until the user is inputing the "sensitive data", so he can not switch to >another record until needed data (name & Postal code) is evaluated (Primary >key is generated). > > If you search my free macro document for the text "Enumerate the controls in a form", you are likely to find something of use. When you create a Form in a Write document, you first obtain the draw page. A Write document has onely one draw page. A form can contain subforms, so you need to know which form contains the control that you desire. Consider this little snippet from my document. Sub EnumerateControlsInForm Dim oForm, oControl, iNumControls%, i% 'By default this is where the controls are oForm = ThisComponent.Drawpage.Forms.getByName("Standard") oControl = oForm.getByName("MyPushButton") MsgBox "Used get by name to get control named " & oControl.Name iNumControls = oForm.Count() For i = 0 To iNumControls -1 MsgBox "Control " & i & " is named " & oControl.Name Next End Sub -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Book: http://www.hentzenwerke.com/catalog/oome.htm Info: http://www.pitonyak.org/oo.php See Also: http://documentation.openoffice.org/HOW_TO/index.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
