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!

Poblem tabing, Need Help. 1

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
0
0
US
Good afternoon. This is the first time I have ever used tab pages in a form, so of course nothing is going right here. My first problem is I can't get the form to setfocus on the combobox I want it to. I have put Me.CustomerNumber.SetFocus in just about every event on the form, in all of the Before's and in Onload and Enter, but nothing appears to get that focus on the combobox. The other problem I have is tabing from the last textbox on the first tab page to the first textbox on the second tab page. Do I have to add a page break somewhere? Thank you to anyone assisting me with this problem.
 
For your first problem...
In Design view, take a look at the Tab Order. That determines the order in which controls receive the focus.

As for tabbing from the last control on Tab Page 1 to the first control on Tab Page 2, I'm not sure whether the tab order will facilitate that or not. Or there may be some other coding needed.

Tom

 
Go to the Microsoft site and download their Sample Forms for Access 2000. One of the samples in that collection has a method to go from one tab page to the next. You may still, however, need to click on the tab page tab in order to view the page, because pages stay behind one another until their tab is clicked.

Tom
 
In the AfterUpdate or LostFocus of the last control on page 1, add the following line to your code:

me.tab2.setfocs
me.tab2control1.setfocus

Good Luck

:) SATHandle

Don't beat your head against the wall unless you know how to plaster.
 
Thank you very much for the responses.
SATHnadle: I tried your solution and it worked, thank you very much for the help.

THWatson: I have checked the Tab Order very carefully and it is exactly the way I want I. If I manually put focus on the combobox and start tabing, it works great. It is the fact that I can not get focus on the combobox. I have tried both DoCmd.GoToControl and .SetFocus in all of the main forms events, nothing works, the combobox hi-lites for a second and then focus goes top the SubForm. In think and checking, I have discover that on a SubForm, in the SubForms's AfterUpDate event, I have a procedure, and that procedure appears to draw the Focus for some reason. I don't understand why and AfterUpDate procedure on a SubForm would cause a focus problem on the main form. Any ideas or suggestions? I will check MS and see if there is something there on this. Thanks for the response.

Thank you one and all for all of the assistance.
 
This is the cause of the problem and it is on a subform.
Private Sub PartNumber_Enter()
If Me.Parent.TypeNumber = 400 Or Me.Parent.TypeNumber = 600 Then
If Me.Parent!Check206 = True Or Me.Parent!Check208 Or Me.Parent!Check227 Or Me.Parent!Check210 Then Me.PartNumber.SetFocus
Else Me.ParentCheck206.SetFocus
MsgBox "Please Check at Least One Before Entering a Part Number or Cancel ECN."
End If
End If
End Sub
This is a procedure to make sure that one of a group of checkboxes have been checked before entering something into this subform. Is there a way to delay this? Thank you for any assistance.
 
I have looked at your Subform procedure. If I understand it correctly, PartNumber is the name of your subform.

Is there anything wrong with the following line?
If Me.Parent!Check206 = True Or Me.Parent!Check208 Or Me.Parent!Check227 Or Me.Parent!Check210

You show Me.Parent!Check206 = True, but you have nothing afer the other 3 checks. I, of course, don't know your form, but just wondered that from reading your procedure.

Something, obviously, is sending the focus to your subform before it should. If the focus goes where you want it and then quickly shifts to the subform, then this code must be doing it.

Tom
 
Thank you for the response, Tom. Simply put this is a check to see if at least one of four checkboxs have been checked, before you came enter data in the subform. But I now think this procedure was masking something else pulling the focus to the subform. I have even tried to make the subform invisible when the main form opened, but it didn't work either, again because of the control goes to the subform. Do you know of anyway of killing a procedure or group of procedures til the subform is made visible? Thank you again for your time and assistance.
PS: I am almost done with this dbase so of course it is screwing up.
 
Of course, screw-ups always happen when you're just about finished. It's Murphy's Law!

I'm not certain about this, but I doubt that making the subform invisible will solve it. Even if it's not visible it's there.

How do you enter the subform? Do you tab from one control to another in the main form and then tab into the subform? Do you click directly in the subform at any point you wish?

When I look at your code you are already in the subform when it fires. And it's saying, "If you're here, you're here, so set the focus to here" so to speak. A bit circular.

The second part says "If you're not here legitimately, then get the heck out and go back there" so to speak. That seems okay, except Access is funny about SetFocus stuff. Perhaps rightly so, to avoid problems.

Is there any way you can set something in the Main form, so that you can't enter the Subform unless at least one of those 4 check boxes have been checked?

I'm still wondering about that code line
If Me.Parent!Check206 = True Or Me.Parent!Check208 Or Me.Parent!Check227 Or Me.Parent!Check210
Would you not have to add = True after each of the other 3 checks, and not only after the first one?

Just brainstorming here.

Tom

 
Thanks again Tom for the response. I have been a busy little bee and now I can truthfully say I hav egood news and bad news. The good news is I have identified the problem-child procedure and I comented it out and the tabing and control and visibility all worked great. Fore every good there is a bad, now the bad news, I couldn't have picked a more need procedure if I tried. Is there a way to have it only work when the subform is visible?
As for your questions, I do tab from control to control, I start at a combobox and the default is ok 80% of the time so I tab to the fabled four checkbaoxs, which now when I click one or more, the subform will become visible. Then I tab into the subform. The only thing I do there is type in part numbers, the rest is automaticly do by the procedures. Then I TAB<Ctrl> to tab out of the subform and continue on the main form. I hope I help clear up your understanding of what is going on.
PS: I sent a week trying to get the Problem-Child procedure to work correctly, dang that Murphy.
 
I'm not clear why you want your Subform not to be visible all the time. However, if that works, it works. I suppose it keeps a user from clicking in there if none of the 4 fabled boxes has been checked.

At the beginning of your Subform code, could you put something such as
If Me.PartNumber.Visible = True Then

Would that work? I haven't tried anything like this. Still brainstorming.

Alternatively, is there a way you can make sure you have checked one of the 4 fabled boxes before you even go into the Subform?

Also if, as you say, the Subform only becomes visible when you have checked one of those, doesn't this in itself solve the problem? Or am I missing something in there?

Tom



 
Thank you again, Tom for the assistance. I enter this at the beginning of the OnCurrent event of the subform and the debugger appeared, this is what I used:
If Me.[Part Number(s)].Visible = True Then
and the full path name:
If Forms!frmECNMasterData400![Part Number(s)].Visible = True Then
I uncommented the rest of the code and a message about I can not hide something that has control. You are correct about what I am doing with the subform, I don't want people entering data until the four checkboxes are set. They turn things on and off all over the place. Nuts I know, but it is working, except for this one procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top