VB Command Order (Access 2002)

I have written a code for a button that tries to set the focus on a text box, delete its contents, insert a specified number then run a query which uses this number. However, although I have done the set focus, delete and send keys command first and then the open query command, it seems to be running it in reverse order, ie query first, on old info, then adding the new info to the box.
I would be grateful for any suggestions about how to cure this.

Re: VB Command Order (Access 2002)

You don't need to set focus to a text box to clear its contents. You can use code such as

Me.txtSomething = Null

where txtSomething is the name of the text box. If the text box is bound to a field in the record source of the form, keep in mind that clearing the value of the text box doesn't affect the value of the field in the underlying table until the record has been saved.