Error generated depends on how the code is called

K

Karen

I have a form with a button that creates table entries (from one table to
another) when pressed based on information on that form. It works fine when
the button is pressed manually on the form.

However, I have attempted to automate the process from another form. I've
made a public subroutine on the form that steps through the records and calls
the button code. From the remote form, lets call it Form2, I open Form1 and
call the code thusly:
Form_form1.AutoRoutine

The call executes seemingly OK, but I've started getting and
"Application-defined or object-defined error" on simple code (assignments
between fields/controls) that functions fine the other way. What's even
stranger is the first time it occurred I 'solved' it by creating local
variables, assigning values to them from the controls, and putting the
variables in the offending If conditional. The second time I got the error,
on a line further down in the code, it persisted even for the simple
assignment of the control value to the variable.

Does anyone know what's up or how to solve this?
 
Top