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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setfocus with bound textbox and frame?

Status
Not open for further replies.

mhanline

Technical User
May 15, 2001
5
0
0
AU
Hello
Forgive me for being such a newbie and everything, but I have a slight problem.
I am using ado data control on my form and have some textboxes connected to the fields in my access db.
I wrote a bit of code for the add new button:
adocust.recordset.AddNew
Fname.SetFocus

(it stops me on that line of code: fname.SetFocus)
It says data member not found or something... The text box(es) are enclosed in a frame, would that be why it is not working? i have no idea
thanks
Michael
 
I suppose Fname is a frame. It doesn't have 'SetFocus' method. If you want to put cursor on textbox in a frame just point directly to the textbox like Text1.SetFocus
 
Nope
fname is the field. I try setting the focus to the fname field, by: fname.setfocus
and it comes up with an error... data member not found!

people say i'm crazy, but I know what it does, and some of my friends in my class have the same problem. the lecturer is stumped
 
oneshadow is right. You do not set focus the the field itself, but to the textbox that you have bound to this field. So if text1 is bound to the fname field then you would go text1.setfocus.
David Paulson


 
Thats my problem, it doesn't work!
Data member not found, it says. I tried. text1.setfocus

Any ideas as to what is wrong? I have made sure the textbox and frame is enabled and visible.
 
Hi Michael:

Can I see the actual code? I remember having a simlar problem and recall that it had to do with the syntax for the addnew or something.

Thanks

Joe Logan Joseph Logan
jlogan@softsource.net
 
okay, in the add new record button, I put this code:

CustAdo.recordset.AddNew
text1.setfocus

It's only two lines of code. Text1 is bound to a field in the database, through adodc on my form.
The funny thing is, that I can setfocus to the bound combobox, but not any of these textboxes.
The weird thing is that when you are typing the code in the code window, and you get to:
text1.
and the list that comes up with the different methods (i think u call them that), it did not come up with setfocus. It also didn't allow me to put in things like enabled either. There were only a few options i could choose from, one I remember was item.
Any ideas Joseph... or anyone else for that matter?
Thanks in advance,
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top