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

Set focus to Tab control when subform has records 1

Status
Not open for further replies.

Utracman

Programmer
Mar 12, 2001
20
US
A97

How would I do this?

One of my tab controls [Critical Issues] has a subform that displays Issues that need to be resolved and when they get resolved they will not show up in the subform. What I want to do is if there are records present in the subform I want to set focus to the Tab control [Critical Issues] when the main form is opened. This way the user is informed they have issues to resolve right away.


Thoughts?

Thansk for the help To learn fron those who have mastered the art..... Saves many headaches!
 
Run a DCount on the query feeding the subform in the OnOpen event of the form, if there are any records use the SetFocus method to higlight the tab.

HTH Joe Miller
joe.miller@flotech.net
 
Joe

I'm close but it always sets focus to the tab even if there are no records.

Code

If DCount([IssueID], "qryCriticalSub", [Sales ID] = Forms!frmBranchMain![txtSales ID]) > 1 Then
Forms!frmBranchMain!tabCritIssues.SetFocus

What am I missing?

Thanks

Dave To learn fron those who have mastered the art..... Saves many headaches!
 
You DCount statement has it's criteria set wrong for one thing. Try this:

If DCount("[IssueID]", "qryCriticalSub", "[Sales ID] = [Forms]![frmBranchMain]![txtSales ID]") > 1 Then
tabCritIssues.SetFocus
End If Joe Miller
joe.miller@flotech.net
 
Another thing, you may want to change your code so that it fires for greater than 0 so that it fires when there are any critical issues. Your current code will only fire if there are 2 issues. Joe Miller
joe.miller@flotech.net
 
Perfect!

Thanks for the help

Dave To learn fron those who have mastered the art..... Saves many headaches!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top