Macro for updating values isnt working

I have these macro that I wrote, its function is to update the values that are in the subform, to the table that it is linked to, when i click a button, something like saving, what I currently have, but I’m having a problem because it isnt working, and I dont know why, it just doesnt update the values at all.

Heres the macro:

REM  *****  BASIC  *****

Sub Salvar

	dim SelecaoCheckState as string
	mainform = ThisComponent.DrawPage.Forms.getByName("MainForm")
	subform = mainform.getByName("SubFormUFM")
	GuardaBox = subform.getByName("Guarda")
	DiariaBox = subform.getByName("Diaria")
	SelecaoCheck = subform.getByName("selecao")
	SelecaoCheckState = SelecaoCheck.state

	if SelecaoCheckState = 1 then
		SelecaoCheckState = "true"
	else
		SelecaoCheckState = "false"
	end if
	
	SelecaoCheckStr = SelecaoCheck.BoundField.getString

	GuardaBoxText = GuardaBox.Text
	DiariaBoxText = DiariaBox.Text
	DiariaBoxStr = DiariaBox.BoundField.getString
	GuardaBoxStr = GuardaBox.BoundField.getString
	if DiariaBoxText <> DiariaBoxStr then
		DiariaBox.BoundField.updateString(DiariaBoxText)
	end if
	if GuardaBoxText <> GuardaBoxStr then
		GuardaBox.BoundField.updateString(GuardaBoxText)
	end if
	if SelecaoCheckState <> SelecaoCheckStr then
		SelecaoCheck.BoundField.updateString(SelecaoCheckState)
	end if

End Sub

Did you try to get the resultzs in a messagebox, for example GuardaBoxText and GuardaBoxStr

Yes I did, it gets the values right, but now I’m having a problem because it is updating, but to old values. When I run the macro, it updates to the old values that were in the text boxes. Example: One is 20 and the other 30, I change them to 30 and 40, when I run the macro the table will be updated to 20 and 30 for some reason, because theyre the previous values.