P
Phil Freihofner
I've recently come across the notion (via Agile/Extreme programming) of
test-driven coding, and am trying to apply this to my VBA-Access work. But so
far my attempts have been clumsy failures.
For example, I tried to write a sub (in a class module, and run via <F5>
key) to open a form and "press" the "new patient" button. I can set the focus
on the form's button, no problem, but two attempts at "pressing" it have
failed:
1) SendKeys {"ENTER"} simply moves my cursor around on the coding page, I
can't seem to get it to set the context of my cursor on the form, even with
using setfocus on the button I want to press.
2) The "cmdNewPatient_Click" subroutine (and most of my forms' subroutines)
are PRIVATE, and thus can't be executed from the module and I'd just as soon
leave them that way.
3) I'd rather not spread the tests about on the various form pages, but
rather keep them in their own space and easily removeable prior to generating
the .mde file.
Is there anything to be gained by Automating an instance of Access remotely
and trying to operate it this way? If so, I need to be able to move around on
a form to imitate typical User interactions, and, a way to examine resulting
fields and reports.
Or is this (moving around on a form like a User) something that can be done
via Macros, and have the VBA "testing" module call the macros as needed? I
know a lot of macro commands can be done in VBA using DoCmd, but...it's been
years since I used the Macros directly, and I certainly don't want them being
exposed in the .mde!
Just thought I'd ask as it seems someone must have already figured this out.
I'm guessing if one were in Visual Studio, that would provide a lot more
testing capabilities. (It did from my short experience with it and VB.NET
from a few years ago.)
Many thanks.
test-driven coding, and am trying to apply this to my VBA-Access work. But so
far my attempts have been clumsy failures.
For example, I tried to write a sub (in a class module, and run via <F5>
key) to open a form and "press" the "new patient" button. I can set the focus
on the form's button, no problem, but two attempts at "pressing" it have
failed:
1) SendKeys {"ENTER"} simply moves my cursor around on the coding page, I
can't seem to get it to set the context of my cursor on the form, even with
using setfocus on the button I want to press.
2) The "cmdNewPatient_Click" subroutine (and most of my forms' subroutines)
are PRIVATE, and thus can't be executed from the module and I'd just as soon
leave them that way.
3) I'd rather not spread the tests about on the various form pages, but
rather keep them in their own space and easily removeable prior to generating
the .mde file.
Is there anything to be gained by Automating an instance of Access remotely
and trying to operate it this way? If so, I need to be able to move around on
a form to imitate typical User interactions, and, a way to examine resulting
fields and reports.
Or is this (moving around on a form like a User) something that can be done
via Macros, and have the VBA "testing" module call the macros as needed? I
know a lot of macro commands can be done in VBA using DoCmd, but...it's been
years since I used the Macros directly, and I certainly don't want them being
exposed in the .mde!
Just thought I'd ask as it seems someone must have already figured this out.
I'm guessing if one were in Visual Studio, that would provide a lot more
testing capabilities. (It did from my short experience with it and VB.NET
from a few years ago.)
Many thanks.