I am a beginner in open office data base. My requirement is...
While loading a form the default value of a number field in that form should be +1 of the last record of the corresponding table.
I was trying to get using a macro...the algorithm of my macro is as said below.
While loading form should display last record.
Then the number field value should take to a variable.
increment the variable.
form will jump to new record.
assign the number field to the value of the variable..
My macro codes are shown below.
Code: Select all
REM ***** BASIC *****
Sub Main
End Sub
sub Startt
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
dim oForm as object
dim oControl as object
dim iopnum as integer
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:LastRecord", "", 0, Array())
oForm = ThisComponent.CurrentController.Model.DrawPage.Forms
oControl = oForm.getByName("MainForm").getByName("fmtOPNumber")
iopnum = oControl.getCurrentValue()
iopnum = iopnum+1
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:NewRecord", "", 0, Array())
oControl.updateInteger(iopnum)
end sub
kindly help me