| View previous topic :: View next topic |
| Author |
Message |
TiredTurk General User

Joined: 03 Aug 2007 Posts: 24 Location: Ankara, Turkey
|
Posted: Thu Sep 20, 2007 8:46 am Post subject: What does "BASIC runtime error: Arguement is not option |
|
|
mean? I have been attempting to teach myself macro programming using Andrew and Quazzie Evil'sdocuments. To see an example of a working macro code, I tried running this code (swiped from Andrew's DB doc)
| Code: |
Sub ButtonCall(oEvent)
Dim i
Dim oButton
Dim oModel
Dim oShape
Dim bFound As boolean
REM First, get the button used to call this routine.
REM Save the button's model.
oButton = oEvent.Source
oModel = oButton.getModel()
REM Iterate through the controls
i = ThisComponent.getDrawPage().getCount()
bFound = False
Do While (i > 0 AND NOT bFound)
i = i - 1
oShape = ThisComponent.getDrawPage().getByIndex(i)
bFound = EqualUNOObjects(oShape.Control, oModel)
Loop
If bFound Then
Print "The button is in cell " & oShape.getAnchor().Cell.CellName
End If
End Sub
|
But get the "Arguement is not optional error on | Code: | | oButton = oEvent.Source |
Using this code from QE
| Code: |
Sub BeforeRecordAction(event As Object)
Dim Form As Object
Dim Control As Object
Form=Event.Source.Model
Control=Form.getByName("laboratuvar")
MsgBox "Hi!" & Control.Text
End Sub
|
I am getting the same error message on | Code: | | Form=Event.Source.Model |
What kinds of errors cause that message? And more importantly, how do you fix them?
Thank you |
|
| Back to top |
|
 |
QuazzieEvil Super User

Joined: 17 Jan 2007 Posts: 599 Location: Houston, TX
|
Posted: Thu Sep 20, 2007 9:11 am Post subject: |
|
|
| how are you calling the function? seems you are not passing the parameter 'Event' |
|
| Back to top |
|
 |
TiredTurk General User

Joined: 03 Aug 2007 Posts: 24 Location: Ankara, Turkey
|
Posted: Thu Sep 20, 2007 11:26 am Post subject: Re: Arguement error |
|
|
Usually just by yelling at it...(sorry I'm bit punchy right now)
When you call a function it looks something like this doesn't it? | Code: |
Sub BeforeRecordAction_laboratuvar_INSERT(event As Object)
........
Dim IsimNe As String
IsimNe="com.sun.star.comp.forms.ODatabaseForm"
........
End Sub
|
If it doesn't, then I have no idea how I am calling the function  |
|
| Back to top |
|
 |
QuazzieEvil Super User

Joined: 17 Jan 2007 Posts: 599 Location: Houston, TX
|
Posted: Thu Sep 20, 2007 11:40 am Post subject: |
|
|
no, that is the function definition.
a function call refers to the execution
for example:
BeforeRecordAction_laboratuvar_INSERT(event)
here I am calling it and passing a parameter named event.
what you need to do is to find that code (the function definition) to some event--in this case the 'Before Record Action' event of a form. when you do that, the 'event' parameter is passed automatically for you. |
|
| Back to top |
|
 |
|