'Expression Builder for a command Button in MS Access

I am new to MS Access and would like to work with buttons of a form. I wanted to understand a point

I have a text box search and I have a button in the form

I don't want to use VBA and with the help of Expression Builder can I clear the Text in Text Box search after clicking the button?

I have tried and it isn't working out. Is it the right way ?



Solution 1:[1]

With expression builder you can only call a user function, macro or vba routine. Try with vba code:

Me.controlName.value = ""

Me is your form.

controlName is the name of your field (in my Screenshot is "txt_somefield")

Click on button, Event, Onclick and put this code (remember to replace your field's name).

Solution 2:[2]

Not sure why you want to use Expression Builder. A simple macro will do the trick.

Select Properties of Command Button, under Events choose ... next to On Clickand then Macro Builder

Add Action, choose your TextBox control name, select Set Property, then Value - and leave Value blank

Set Property Macro

Save and Exit and Run

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Miki13
Solution 2 dbmitch