Text Box update after Lost Focus

AccessBug27

New member
Local time
Today, 17:27
Joined
Jun 5, 2017
Messages
8
I have an unbound Text Box that the user enters data into which is then used by VBA Code when a button is clicked on the Form.

If I use TAB to exit after changing the data then the correct value is used by the code.

However if it loses Focus, ie the Button is clicked, the old value is used, not the displayed changed value in the box.

How can it update the data in the unbound text box when it looses focus?
 
You didn't show us the code on what the button click does.
 
Private Sub ComboARid_AfterUpdate()

Set dbSAP = CurrentDb

'select reseller from entered reseller Id
strSQL = "SELECT * FROM Resellers WHERE [ARid] = '" & ComboARid & "'"
Set rstResellers = dbSAP.OpenRecordset(strSQL, dbOpenDynaset)

ARidName.Value = rstResellers!ARidName

End Sub
 
Why not simply bring the ARidName as another column into the combobox, and populate the displayed name from the column value. You don't need a recordset to do this.

In the control source of AridName put in = ComboARid.Column(2) assuming the additional column you have just added is the third column.
 

Users who are viewing this thread

Back
Top Bottom