How to run proceedure when clicking Cmd Btn on form ??

  • Thread starter Thread starter MyEmailList
  • Start date Start date
M

MyEmailList

I just added a Command Button to a Form.

I wanted the user to be able to click the button to run a proceedure.

The proceedure will...

- copy text from one field_x on the form
- add it to the text in field_y on the form (concatenate)
- clear field_x

We call the button "Update"

We can do this by creating an "event proceedure" for the form... like
run the proceedure when they go to the next form or whatever... but
wanted an actual button they would click.

I can't see anything in the Command Button options that says "run
proceedure" or whatever...

There is a "Refresh Form Data" option but I don't know if that is what
I want.

Thanks for any help.

Mel
 
You need to actually write the procedure. Something like

Me.Field_y = Me.Field_y & Me.Field_x
Me.Field_x= ""
 
I can't see anything in the Command Button options that says "run
proceedure" or whatever...

View the Properties of the command button. On the Events tab select the Click
event. Click the ... icon by it and choose "Code Builder".

Access will open the VBA editor window with two lines:

Private Sub buttonname_Click()

End Sub

Write whatever code you want between these lines; choose Debug... Compile <my
database> from the menu; save, and your button will run that code when you
Click it.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top