Update Button

J

J

I was wondering how I could create a button that will update 2 text
boxes in a form when I click the button. Any help on this topic is
appreciated.
 
S

Steve Schapel

J,

I think you will need to explain what you mean by "update 2 textboxes".
Maybe an example would help to make your meaning clearer.
 
J

Jerry Whittle

Depends a lot on what you want to do, but in general it's easy enough. For
example you could create a button that sets the date and time of a text field
to the moment that you click it.

Open up the form in design view.
First you need to know the name of the text box. We'll call it txtLastUpdate.
Next make sure that the Toolbox is open and turn off the Control Wizard.
Click on Command Button on the Toolbox then draw the button on the form.
If the Property sheet for the button is not displayed, right click on the
button and select Properties.
Go to the All tab and give the button a meaningful caption.
Next go to the Event tab and click on the On Click event. You should see the
build button to the right. It has three dots ... on it. Click the Build
button. Go to Code Builder.
Just above where it says End Sub put the following:

Me.txtLastUpdate = Now()

Go up to Debug on the menu and select Compile. If you don't see any errors,
hit the Save button. Go back to the form and save it. Go to Form view and
test the button.

That's just one quick example of what you can accomplish.
 
Top