Re: Access 2007 bug? Focus does not stay on new record in code



On 30 May 2007 21:59:42 -0700, Owen <google@xxxxxxxxxxxxxxxxx> wrote:

Ah, I think you're onto something. I can confirm this behavior to be
different between A2000 and A2007.
My code:
RunCommand acCmdRecordsGoToNew
Me.CategoryName = "Hello"
Me.CategoryName.SetFocus
Debug.Print Me.CategoryName = "Hello", Me.CategoryName.Value,
Me.CategoryName.Text

In A2000 it prints the data about the new record, whereas in A2007 it
prints the data about the record you came from. Even when I added the
SetFocus line.

Weird. Will have to look at that some more.

-Tom.



I just tried these 2 lines:
RunCommand acCmdRecordsGoToNew
Me.SomeTextField = "HELLO WINDOWS"
in a continuous form, and it worked as expected: the cursor went to a
new record, the field now has the value, and focus is on that row, on
the (first) ID field.

You may want to use an elimination strategy to see where your code
goes south.

Well for me, the cursor goes to the new record and inserts the
specified text, but if the code then says If Me.SomeTextField="HELLO
WINDOWS" Then, this evaluates as false.

Owen



.