Here's a strange one (at least to me). What the following code is supposed to do is set the mousepointer to the hourglass when the user clicks on the cmdSearch button, set the mousepointer back to default, give the focus to the txtCompanyNumber text box, and select the text in the txtCompanyNumber text box. I have the .Default property of the cmdSearch button set to true to please the anti-mouse-using-data-entry-users. Everything works find if I actually click the cmdSearch button. However if I hit the Enter key the mousepointer does not change and the text in the txtCompanyNumber text box does not get selected. If I step through the code, it all gets executed, and the value of the mousepointer is correct. But it won't change under normal usage. I've played with form refreshes, changing screen to the name of the form, DoEvents, etc. But I can't get it to work. Does anyone know why this is? I know I can trap the enter key and achieve the same results, but it'd be nice if this worked.

VB Code:
  1. Private Sub cmdSearch_Click()
  2.     Screen.MousePointer = vbHourglass
  3.     UpdateRecordset BuildSQLText
  4.     cmdFirst.Enabled = True
  5.     cmdPrevious.Enabled = True
  6.     cmdNext.Enabled = True
  7.     cmdLast.Enabled = True
  8.     cmdVoucher.Enabled = True
  9.     cmdViewInvoice.Enabled = True
  10.     dgInvoice.Enabled = True
  11.     Screen.MousePointer = vbDefault
  12.     txtCompanyNumber.SetFocus
  13.    
  14. End Sub
  15.  
  16. Private Sub txtCompanyNumber_GotFocus()
  17.     txtCompanyNumber.SelStart = 0
  18.     txtCompanyNumber.SelLength = Len(txtCompanyNumber.Text)
  19.    
  20. End Sub

Thanks,

Leecher