|
-
Nov 19th, 2002, 07:19 AM
#1
Thread Starter
Hyperactive Member
Finding Cursor Focus
Greetings to All!
I have a form with 2 combo boxes (CBOEmpNo, CBODeptNo) and few other controls.
I have a Search Button, that need to search on Emp Number, if CBOEmpNo has a value. Similarly, I am searching on Dept Numbers, if there is a value on CBODeptNo.
Now, if value exists in both the fields, I need to search based on the position where the cursor is? How do I find in which field the the cursor is located on my form?
Or is there any other logical way to handle?
Thanks and Regards,
Venkat.
Thanks and Regards,
Venkat.
-
Nov 19th, 2002, 07:26 AM
#2
Member
pl try using
screen.ActiveControl
-
Nov 19th, 2002, 07:53 AM
#3
Thread Starter
Hyperactive Member
Hi,
Thanks for the reply.
My code is like this..But its not solving the purpose.
If cboBnkId.Text <> "" And Screen.ActiveControl Then
<Blah..Blah..Blah....>
ElseIf cboBnkNum.Text <> "" And Screen.ActiveControl Then
<Blah..Blah..Blah....>
End If
Rgds,
Venkat.
Thanks and Regards,
Venkat.
-
Nov 19th, 2002, 03:01 PM
#4
How about something like
VB Code:
Private MyControl As Control
Private Sub cboEmpNo_GotFocus()
Set MyControl = cboEmpNo
End Sub
Private Sub cboDeptNo_GotFocus()
Set MyControl = cboDeptNo
End Sub
Private Sub cmdSearch_Click()
If Len(cboEmpNo.Text) > 0 And Len(cboDeptNo.Text) > 0 Then
'then both have something in them. use whichever has focus
'search for MyControl.Text
Else
'search by which ever one has something in it
End If
End Sub
-
Nov 20th, 2002, 12:15 AM
#5
Thread Starter
Hyperactive Member
Thanks and Regards,
Venkat.
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
|