Hi there,
I have a small application that I have written for Open Office, for basic data entry, I comprises of a main dialog box that requires an integer value that must be entered, and then two buttons. These two buttons open a small box each that accepts a string in one and an integer in another.
The program works wonderfully so long as both the buttons are used. Yet if either of the buttons aren't used, I get as Object variable not set error as a function is called as part of the data entry procedure.
Due to the way Open office uses a GUI with buttons to assign an event to a button, I can't work out how to check if it has or has not been called, so I was hoping that I could have the function called yet return either "Null" or "Empty" if the dialog box is not actually opened.
Here is the code that is causing the problem;
Code:
If TyreChange() = Null then <---TyreChange() is my function
TyreSet = CurrentTyres
Else
TyreSet = TyreChange()
End If
And here is the Function that is called:
Code:
Function TyreChange()
Dim TyreSet As String
TyreSet = oTyreDialog.GetControl("TextField1").Text
if TyreSet = Empty Then
TyreChange = Null
Else
TyreChange = TyreSet
End If
oTyreDialog.endExecute()
End Function
This function is intentionally called by the uers pressing a button, and when it is called there is no problem. However, the problem arises when the button isn't pressed, but as you can see, it gets called by the program and but of course no data is entered. I have tried as you can see to set the variables to Empty or Null, but the program is still looking for an input that is not there. I am aware that one solution would be to use an error handler, I was however, wondering if there is a better way to deal with this issue.
I have listed the offending code, though if you need the rest of it I can post it there is rather a lot though. Any help on this is much appreciated.
Kind regards
iFunc