G
Guest
I have a sub routine in a form module that executes some code on the click
event of a command button. The first few lines of code verify that the user
entered in all of the required fields and displays a message box to the user
asking if they are sure they want to complete the task. After they click ok,
a call is made to a function in a standard code module, where criteria is
established and records get appended. From there, the control returns back
to the original form code click event procedure where it finishes a few lines
of code. It creates a new querydef and uses the function value as criteria
to show the user the records they just created and sets the form controls
back to null.
What doesn't make sense to me is that I had to remove the line that makes a
call to the function because it was running twice, giving me duplicate
results. I don't understand how Access would know the appropriate time in
sequence to make the function call. What is going on? Is this an
unexplained phenomena in Access?
The only thing I can think of is that because I initially had the made the
function call in the code, Access has since gotten smart and knows that's
when it's supposed to execute. I've also since added a few lines of code
before the function executes and after it and it still executes at the right
time. So wierd!
event of a command button. The first few lines of code verify that the user
entered in all of the required fields and displays a message box to the user
asking if they are sure they want to complete the task. After they click ok,
a call is made to a function in a standard code module, where criteria is
established and records get appended. From there, the control returns back
to the original form code click event procedure where it finishes a few lines
of code. It creates a new querydef and uses the function value as criteria
to show the user the records they just created and sets the form controls
back to null.
What doesn't make sense to me is that I had to remove the line that makes a
call to the function because it was running twice, giving me duplicate
results. I don't understand how Access would know the appropriate time in
sequence to make the function call. What is going on? Is this an
unexplained phenomena in Access?
The only thing I can think of is that because I initially had the made the
function call in the code, Access has since gotten smart and knows that's
when it's supposed to execute. I've also since added a few lines of code
before the function executes and after it and it still executes at the right
time. So wierd!