Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to focus on text fields used as buttons

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
Hi there, I was trying to "work-around" finding or creating a bmp to use on a button to make it pretty. So what I did was used a text box and rectangle combination and set the "onclick" of the text box to the code to open the report. It all worked perfectly, except I realized at that point that the text box cannot recieve the focus. So, when I am entering the date in the other text box, that is the criteria of the report, I have to no hit enter or tab to be able to run the report. (because the date isn't automatically entered since there is no control to get the focus off of the date field.)Is there a way to have the date field "entered" when I click on the button (text box) so that the user doesn't have the extra step of hitting the enter key. Is this understandable? Let me know if I can explain further. Thanks for your help. Dawn
 
Dawn,

I don't quite understand what you are doing. A user enters a date and as soon as the date is entered you want the report to run by running the code behind the other text box? Have I understood properly?

Nick
 
Ok, let me explain better, sorry. Normally when you type in a date and click on a button to run a report, it will automatically switch the focus from the text box to the button without hitting the tab or enter key. This will, in essence "enter" the date that was typed in. But since I am using a lable as a command button (I said text box earlier but meant label), when I enter the date in the first text box, it forces me to hit tab or enter before it will recognize that the field is not empty and has a date in it. I found out that this is because the lable cannot recieve the focus like a button or text box can.I t is a minor thing, but I am just trying to lessen the key stokes for the user. So, when the user types in a date and clicks on the button(label with click event set)I want it to automatically act as if the user hit the tab or enter key to "enter" the date that was typed in. Does this help? Thanks for your help. Dawn
 
Dawn,

Sorry I didn't get back to you last night. It was quite late for me (I am in UK).
What u could do is, on the after update of the text box (or on the exit event), call the click event of the label.

sub text1_afterUpdate()

label_Name_Click

end sub

I'm still not sure whether I have fully understood you though. Please let me know,

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top