Backgound: I have a form the records a Homecheck’s progress. Associated will be a Homecheck report. I wish for the user to be able to browse to find said homecheck report and have that location (file path) displayed in a text box (because, as you are no doubt aware, a Text Box is data aware - data can be written to, and retrieved from the relevant database table column - while the File Selection control is not). I’ve also configured a Push Button to open said report that works.
Progress: I have plagiarised a basic macro (or two!) so that the file path selected via the File Selection control is copied to the relevant Text Box. It is displayed there, and the report can be opened via the aforementioned Push Button.
The Problem: However, the appended file path seems to be temporary, as it is not saved to the database. If one clicks into the Text Box and make the smallest of changes - e.g. space and then delete it (the space) - the record senses a change has been made and can be saved. So the Text Box, despite having the file path appended to it, has not been suitably ‘nudged’ (for the want of a better term) to detect the change. The following is the macro I’m using, invoked from the ‘Text modified’ event on the File Selection control. (I tried a couple of other events, but the result is either the same or nothing happens).
Sub ChangeFNameHC(oEvent As Object) 'For the homecheck(HC) form Dim oForm As Object Dim oSubForm As Object Dim FilePath As String FilePath = "" oForm = ThisComponent.getDrawPage().getForms().getByName("AddAmendHomecheck") ' oForm=ThisComponent.DrawPage.Forms.GetByName("AddAmendHomecheck") ' oForm = oEvent.Source.Model.Parent oSubForm = oForm.getByName("SubForm") FilePath = oSubForm.getByName("SelectFile").Text oSubForm.getByName("txtpath_to_hc_rpt").Text = FilePath ' oForm.getByName("txtpath_to_hc_rpt").updateString(FilePath) ' oSubForm.getByName("txtpath_to_hc_rpt").updateString(FilePath) End Sub
produces the error:
BASIC runtime error.
An exception occurred
The next line produces:
BASIC runtime error.
Property or method not found: updateString.
Frustrating, to say the least, as I feel as though I’m very nearly there!