Which event?

LaurieW

Registered User.
Local time
Today, 09:08
Joined
May 9, 2002
Messages
99
I have a form that has (among other things):

1) a delete button (to delete a record)
2) a Search Payee box (that lists all payee names)
3) an SSN text box

I have code in the "On Enter" event of the SSN text box that pops up a message box asking which way to format the SSN (regular or as tax id). This works fine when entering a new record.

I just discovered, however, that when I delete a record then this message box comes up as well and I don't want it to. Instead I want to use the code "srchPayee.SetFocus" after a record is deleted to move the cursor/focus to the Search Payee box so that the SSN message box does not invoke.

I've tried putting the "srchPayee.SetFocus" in events on the form and also on the delete button, but no matter what I do the SSN message box still pops up after the record is deleted. Which event can I put this code in so that after deleting the record the focus moves to the Search Payee box and the SSN message does not appear?

Thanks!
Laurie
 
have you tried moving the focus before you delete the record? (in the same procedure).
w
 
Is the focus actually moving to the SSN text box?
 
Yes, I tried adding the code "srchPayee.SetFocus" before this code on the On Click event of the delete button:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

which didn't work either (still got the SSN message box).

And, yes, the focus really does move to the SSN message box (to answer jrjr's question).
 
Try this:
(just use your data where applicable)

Private Sub Command14_Click()
On Error GoTo Err_Command14_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

[Forms]![yourformname]![srchPayee].SetFocus

Exit_Command14_Click:
Exit Sub

Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click

End Sub
 
Last edited:
No, that didn't work ... same thing happens where the SSN message box pops up.
 
Do you have any SSN.setfocus commands for the form load or other areas?
 
Sorry, was having major connectivity issues here!
You could also try Setting the TabStop property to No for the SSN box
 
What a great idea! I do have the ssn.setfocus code in other areas. But your idea of setting the tab stop for the SSN field to no worked like a charm. And so simple. Thank you so much!!! On to other things........thanks again.
 

Users who are viewing this thread

Back
Top Bottom