In the regular form mode, I can see the data from the field "Name" in all the records in the pull-down list, so the link with the field is OK.
However, when I start typing the search string, I get the following error message: com.sun.star.container.nosuchelementexception.
The reason why is clear: I am using a macro that I found online (https://neowiki.neooffice.org/index.php ... _the_Macro) which obviously contains references and variables that I need to adapt:
Code: Select all
Sub SearchByState
dim oFilter as object
dim oFormCtl as object
oFormCtl = ThisComponent.Drawpage.Forms.getByName("Standard")
oFilter = oFormCtl.getByName("StateSearchListBox")
if oFilter.CurrentValue <> "" then
oFormCtl.Filter = "State LIKE " + "'"+oFilter.CurrentValue+"'"
oFormCtl.ApplyFilter = True
else
oFormCtl.ApplyFilter = False
end if
oFormCtl.Reload
End Sub
The error refers to the 0FormCtl-line but I cannot figure out what "Standard"is: is it the name of a field, a database, or something else?
The same probably goes for "StateSearchListBox" on the next line.
I have used the trial-and-error way but that didn't work
Any of the following three kinds of input would help me a lot:
- an explanation of the variables in the code
- a referrral to a (preferably concise) syntax guide so that I can figure it out myself
- another macro that would do the job.
Thanks very much in advance!