|
-
Apr 22nd, 2004, 02:36 PM
#1
Thread Starter
Member
Command Button set as Default Problem
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:
Private Sub cmdSearch_Click()
Screen.MousePointer = vbHourglass
UpdateRecordset BuildSQLText
cmdFirst.Enabled = True
cmdPrevious.Enabled = True
cmdNext.Enabled = True
cmdLast.Enabled = True
cmdVoucher.Enabled = True
cmdViewInvoice.Enabled = True
dgInvoice.Enabled = True
Screen.MousePointer = vbDefault
txtCompanyNumber.SetFocus
End Sub
Private Sub txtCompanyNumber_GotFocus()
txtCompanyNumber.SelStart = 0
txtCompanyNumber.SelLength = Len(txtCompanyNumber.Text)
End Sub
Thanks,
Leecher
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|