Using code instead of SendKeys

M

MNT

I have a macro that uses Sendkeys and it works fine in access2000 but has a problem in access2003. From all I've read in this newsgroup, SendKeys isn't the way to go. I want to convert to using code for this macro. The macro tabs back three times, (i.e., goes the the textbox three tabs prior), copies, moves forward three times and pastes. The textbox controls are haphazardly named. However, the tab order is something I could rely on. Is there a way I could use the tab order to move forward and backward to the right textbox so I can copy/paste? Thx.
 
G

Gary Miller

One of the beauties of doing things like this in Access, is
the simplicity of just being able to refer to the bound
controls and modifying them as needed in this way.

I am not totally clear what you are doing with your moving
through the Tab Pages, but I have a feel that those moves
may not even be needed. You can refer to a control directly,
bypassing the pages, by just using it's name. With the
former, you can also just assign the value to the control.

#1 - If your controls are " haphazardly named " fix this at
the get go. You will just be prolonging agony if you don't
do it now!

#2 - Here is an example of how to move to the control that
you want to go to depending on whatever....

If Me!Value > 10 Then
Me!YourControlName.SetFocus
' Do Whatever....
Else
Me!YourOtherControlName.SetFocus
' Do What Else...
End If
--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
MNT said:
I have a macro that uses Sendkeys and it works fine in
access2000 but has a problem in access2003. From all I've
read in this newsgroup, SendKeys isn't the way to go. I want
to convert to using code for this macro. The macro tabs back
three times, (i.e., goes the the textbox three tabs prior),
copies, moves forward three times and pastes. The textbox
controls are haphazardly named. However, the tab order is
something I could rely on. Is there a way I could use the
tab order to move forward and backward to the right textbox
so I can copy/paste? Thx.
 
N

Nikos Yannacopoulos

Try using SetValue in the macro instead, with arguments:
Item: [Name of control copied to]
Expression: =[Name of control copied from]

Nikos
-----Original Message-----
I have a macro that uses Sendkeys and it works fine in
access2000 but has a problem in access2003. From all I've
read in this newsgroup, SendKeys isn't the way to go. I
want to convert to using code for this macro. The macro
tabs back three times, (i.e., goes the the textbox three
tabs prior), copies, moves forward three times and pastes.
The textbox controls are haphazardly named. However, the
tab order is something I could rely on. Is there a way I
could use the tab order to move forward and backward to
the right textbox so I can copy/paste? Thx.
 

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

Top