Converting macro to code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

We have a system that was developed in Access by a summer student several
years ago. We are having a problem with one of our functions that calls a
macro. There are some SendKeys actions in the macro that have the Wait
option set to "Yes" but the waiting is not long enough so we are running into
problems with the macro "getting ahead of itself." This is what an Access
developer suggested.

So we want to convert the macro to code.

This is what needs to be done:
- change the value of two fields of the current record being displayed in
the form
- make a duplicate record of that record and change two fields in that record
- display the new record in the form

So, in the On Click event of the button, we need to choose Event Procedure
and add the code. I can get that far, but we do not have in-house Access
knowledge. So I am stuck as to what commands to use to make these changes
descrived above. How do I refer to the table in the code? How do I refer to
the current record? How do I change the values in the appropriate fields?
How do I copy the record and add a duplicate record, position the record
pointer to the new record and change the values in the appropriate fields?

In a language that I am familiar with, I could do these things in minutes.
But I don't know how to do it in Access and the programmer that we consulted
said it would cost several hours in labour. We are non-profit and can't
afford it. Any help would be appreciated.

Thanks,

Joe
K-W Humane Society
 
Hello,

We have a system that was developed in Access by a summer student several
years ago. We are having a problem with one of our functions that calls a
macro. There are some SendKeys actions in the macro that have the Wait
option set to "Yes" but the waiting is not long enough so we are running into
problems with the macro "getting ahead of itself." This is what an Access
developer suggested.

So we want to convert the macro to code.

This is what needs to be done:
- change the value of two fields of the current record being displayed in
the form
- make a duplicate record of that record and change two fields in that record
- display the new record in the form

So, in the On Click event of the button, we need to choose Event Procedure
and add the code. I can get that far, but we do not have in-house Access
knowledge. So I am stuck as to what commands to use to make these changes
descrived above. How do I refer to the table in the code? How do I refer to
the current record? How do I change the values in the appropriate fields?
How do I copy the record and add a duplicate record, position the record
pointer to the new record and change the values in the appropriate fields?

In a language that I am familiar with, I could do these things in minutes.
But I don't know how to do it in Access and the programmer that we consulted
said it would cost several hours in labour. We are non-profit and can't
afford it. Any help would be appreciated.

Thanks,

Joe
K-W Humane Society

Why not use the built-in "Convert Macros to Visual Basic" tool.
Click on any macro on the Macro Objects page of the main database
folder.
Then click on:
Tools + Macros + Convert Macros to Visual Basic.
 
Re: Why not use the built-in "Convert Macros to Visual Basic" tool.

Because I expect that the Send Keys in the code will pose the same
problem...I'd prefer to make the changes to the data directly rather than
using Send Key through the form....

I expect this is an easy change, but am I expecting too much?

Thanks,
Joe
 

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