Set a base formatted field value by macro

image description
I

Please, how do I set a value in a formatted field, formatted as currency. It is not tied into a DB field. Have tried .CurrentValue= and .SelectedValue=. One was not recognised and the other was read only error.
formContainer=ThisDataBaseDocument.FormDocuments.getByName(“Master Maintenance”)
formContainer.open
’ wait 500
mainForm=formContainer.Component.getDrawPage().getForms().getByIndex(0)
control=mainForm.getByName(“fmtAllBanks”)
control.CurrentValue=SumAllGifters

Thankyou any help would be appreciated.

Answered below.

1 Like

Maybe use an SQL Update statement, search for update and check out the doco for your database

as I mentioned the field is not tied to a DB. It is being calculated and placed in the field for display.

I don’t know if this will help or not. I would use xray tool to try to make absolutely sure the object I am trying to set is correct. Be careful of structures that look like strings. Try your procedure on a field without formatting to see if you are close to the answer.

If that doesn’t help, maybe search the open office forum. There is a lot of macro discussion there.

-hink

I found an answer with a bit of trial and error.

control=mainForm.getByName("fmtAllBanks")
control.EffectiveValue=var

Find the control then use EffectiveValue. I don’t know if it’s the correct way but it works.
To get the value use CurrentValue.

control=mainForm.getByName("fmtBank")
Ba=control.CurrentValue

I hope this helps.