MS Access 2003 - VBA code to copy 1 field to another in the same form

Dear Experts
I have a form named address.  The form contains fields named:
Business address
Invoice Address

I want to add a button to the form that will copy the details in business address to invoice address.

The actual form is slightly more complicated but if I can understand the above then I will be able to adapt and apply it.

Can someone please help with the VBA?

Thank you.
kevin1478Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TextReportCommented:
If they are both on the same form then in your Button's On Click event procedure you can

Me!InvoiceAddress = Me!txtBusinessAddress

Cheers, Andrew
0
kevin1478Author Commented:
Thank you.

Ive implemented the code as suggested and I get the error:

The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Office Access was communication with the OLE server or ActiveX Control.

To test the error I added a button using the wizard to close the form and I got the same error.

Any ideas please.
0
Mike EghtebasDatabase and Application DeveloperCommented:
try:

Me!InvoiceAddress.setfocus
Me!InvoiceAddress = Me!txtBusinessAddress

Assuming this code is running from the same form as the one with these two text boxes on them.

Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Mike EghtebasDatabase and Application DeveloperCommented:
correction...

Assuming this code is running from the same form as the one with these two text boxes on it.
0
TextReportCommented:
You must ensure you get the names of the controls correct. Looking at what you said in the first posting it could be

Me![Invoice Address] = Me![Business Address]

Cheers, Andrew
0
kevin1478Author Commented:
Thank you. All working.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.