Sorry for the delay Bob, been rather busy today
Bob Hughes said:
Wayne,
I do have Tab Index set to 0. I've always set that from the view, tab
order window.
In that case I can only assume that some VBA code is calling the
SetFocus property of another control - perhaps in the OnOpen/OnCurrent
events? Also just check that the TabStop property is set to True.
Sorry I did not explain my problem clearly.
The form is intended to show the status of an order to the user, but
if he does not have an order in progress I just tell her so & then
attempt to return to pick up a new user ID. He could have typed in
the wrong ID.
The DB is secure but this part is open to the public where they have
write access to one table. I'm counting on the integrity of the
employees.
Ok, well the database security shouldn't affect anything here...
The ID text box is in the form header. The problem appears to be
linked to the way I have the record source query set up. It has a
[Forms].[FrmCurrent].[EmployeeID]
in a criteria field. and if the query result is empty I can not set
focus, but if the query has information then I can set focus.
This is a bit odd. I can't replicate your problem - however I am
using Acc2k3.
Perhaps try this...
Me.FormHeader.Controls.Item("EmployeeID").SetFocus
This specifically references the object from within its container, the
FormHeader. It sounds like an Access quirk but the above should fix
it. Obviously you also need to make sure you don't reference any other
form controls after the SetFocus call as anything could potentially
take over the focus.
If your still having problems, can you post your code that pops up the
message box and sets the focus, oh and tell us what version of Access
too please
Cheers,
Wayne Phillips
http://www.everythingaccess.com