This used to work in A97 but not in A2007

M

Mike D

We are changing from Access 97 to Access 2007. Most of my forms work with no
problem. I have a couple of minor glitches that I could use some help with.

Main form "NEW_ORDER_ENTRY" with a subform "CUST ID subform FOR NEW ORDER
ENTRY" for looking up parts. When I double click in the "CUSTOMER" field in
the subform the "PART_ID" field from the subform gets copied to the
"MSDATA.PART_ID" field in the main form. Everything works up to this point.
I then want the focus to shift to the "MSDATA.PART_ID" field in the main
form, but it stays in the "CUSTOMER" field in the subform.

The code from A97 was:

Private Sub CUSTOMER_DblClick(Cancel As Integer)
Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID] = Me!PART_ID 'This still works in
A2007
Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID].SetFocus
End Sub
This worked for years

In A2007 I have tried:

Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID] = Me!PART_ID
Forms!NEW_ORDER_ENTRY.SetFocus
Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID].SetFocus

and

Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID] = Me!PART_ID
CUSTOMER.ReleaseFocus
Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID] = Me!PART_ID

and

Forms!NEW_ORDER_ENTRY![MSDATA.PART_ID] = Me!PART_ID
DoCmd.SelectObject acForm, "NEW_ORDER_ENTRY"
Forms!NEW_ORDER_ENTRY.GoToControl [MSDATA.PART_ID]

and a couple of other combinations of thes commands, with various errors
about not finding form, not finding field etc., but the focus always stays
in the subform. I tried putting the code in the lost focus event of the
customer field and tabbed out of it and it still wouldn't go to the main
form.

When we get this working I will move to the next little glitch

Any suggestions would be greatly appreciated.

TIA,
Mike D.
 
M

Mike D

I forgot to mention that when I step this through in debug the original code
works ok in A2007.

Mike D.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top