On Sep 21, 6:47*pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> On Tue, 21 Sep 2010 13:46:50 -0700 (PDT), BrianDP <bdp...@gmail.com> wrote:
> >Sorry if I was unclear. *That Lcontrol is just a local table, two
> >columns, first one is autonumber, second one is a text field. *When
> >you close the form, the script runs that writes the account number of
> >the current record to lcontrol!lastcust. *Then next time you go to
> >open that form, it'll open the form to the customer you were on last
> >time you were on the form. *Make any sense?
>
> >Still, *why would the value of that field be reported differently
> >depending on where the code was called from? *(being called from a
> >button, as opposed to being stuck to the 'close' event.)
>
> Again... a table HAS NO ORDER.
>
> If there are 612 records in lcontrol, Access will move to whatever recordit
> finds convenient on MoveFirst. This might well be a different record if you
> open it from code than from the UI; it might be a different record if youopen
> it from two bits of code.
>
> MoveFirst *in a Table* is not terribly useful. I'd really suggest openinga
> Query that retrieves a single record.
>
> If lcontrol has only one record... that's different.
> --
>
> * * * * * * *John W. Vinson [MVP]
> *Microsoft's replacements for these newsgroups:
> *http://social.msdn.microsoft.com/For...-US/accessdev/
> *http://social.answers.microsoft.com/.../en-US/addbuz/
> *and see alsohttp://www.utteraccess.com
Sorry for being unclear. YES. Lcontrol has only one record. Again,
because I have this straight in MY mind, I just assume it is crystal
clear to everyone else. So Yes, only one line, so, no reason to tell
it grab only one, because there IS only one. And, when you leave a
form, it moves to the first record of Lcontrol, and writes the account
number there on the first line of Lcontrol.
Okay, for the next mesage from Mike Painter there.. If you run the
routine from a button, it works correctly. It write the account
number of the current record into that first line of Lcontrol.
However if you have the code setup to run in the Close event, then it
doesn't write the correct number- It appears to be writing the correct
field to the file. However if you run the code triggered from the
Close event, somehow the current record gets changed, so what it shows
in code that is going to be written, is NOT the current Account
number.
Thanks for your help guys!
-Brian