We have our data-entry form set up with a main form (representing the customer info) and a sub-form (representing the items they want). This is similar to the Order and Order subform in Northwind. The problem we’re having is when the end user is in the subform entering items and then wants to add a new customer, the subform is still active, so they proceed to type away without noticing and then get stuck, as they haven’t filled out the customer information first. Is there a way to get the focus back on the main form without having the user do, for example, a CTRL+TAB?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
return to main form from subform (Access 2000 SP2)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » return to main form from subform (Access 2000 SP2)
- This topic has 6 replies, 3 voices, and was last updated 19 years, 9 months ago.
Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerJuly 23, 2004 at 2:57 pm #855212See MSKB article ACC2000: How to Move from Subform to Main Form by Using TAB or ENTER.
-
WSgarbsmj
AskWoody Lounger -
WSgarbsmj
AskWoody LoungerJuly 23, 2004 at 5:15 pm #855248After I tried out the example in the KB article, I realized this wasn’t exactly what I had in mind, as the vb code had to be tied to a specific field, and it would be impossible to tell exactly where the end user would be in the subform when they decided to add a new customer. So what I did was go to the first field on the subform (item) and put this code on the GotFocus event(where F_CustQuotesMain is the main form and F_CustQuotesSub is the subform):
Private Sub Item_GotFocus()
On Error GoTo Error_Focus
If IsNull(Forms![F_CustQuotesMain]![CustID]) = True Then
MsgBox “Sorry, you cannot enter items without a customer.”
Forms![F_CustQuotesMain]![CustID].SetFocus
Forms![F_CustQuotesMain]![F_CustQuotesSub].Requery
End If
Exit Sub
Error_Focus:
MsgBox “you must be on a record with data”
Exit Sub
End SubSo now, when someone gets distracted and clicks the wrong thing, they’re brought right up to the customer id field where they should have been in the first place.
-
WSNYIntensity
AskWoody Lounger
-
-
-
WSgarbsmj
AskWoody LoungerJuly 23, 2004 at 5:15 pm #855249After I tried out the example in the KB article, I realized this wasn’t exactly what I had in mind, as the vb code had to be tied to a specific field, and it would be impossible to tell exactly where the end user would be in the subform when they decided to add a new customer. So what I did was go to the first field on the subform (item) and put this code on the GotFocus event(where F_CustQuotesMain is the main form and F_CustQuotesSub is the subform):
Private Sub Item_GotFocus()
On Error GoTo Error_Focus
If IsNull(Forms![F_CustQuotesMain]![CustID]) = True Then
MsgBox “Sorry, you cannot enter items without a customer.”
Forms![F_CustQuotesMain]![CustID].SetFocus
Forms![F_CustQuotesMain]![F_CustQuotesSub].Requery
End If
Exit Sub
Error_Focus:
MsgBox “you must be on a record with data”
Exit Sub
End SubSo now, when someone gets distracted and clicks the wrong thing, they’re brought right up to the customer id field where they should have been in the first place.
WSHansV
AskWoody LoungerJuly 23, 2004 at 2:57 pm #855213See MSKB article ACC2000: How to Move from Subform to Main Form by Using TAB or ENTER.
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
How to get Microsoft Defender to honor Group Policy Setting
by
Ralph
33 seconds ago -
Apple : Paragon’s iOS Mercenary Spyware Finds Journalists Target
by
Alex5723
8 hours, 23 minutes ago -
Music : The Rose Room – It’s Been A Long, Long Time album
by
Alex5723
9 hours, 29 minutes ago -
Disengage Bitlocker
by
CWBillow
10 hours, 52 minutes ago -
Mac Mini M2 Service Program for No Power Issue
by
Alex5723
11 hours, 28 minutes ago -
New Win 11 Pro Geekom Setup questions
by
Deo
13 hours, 12 minutes ago -
Windows 11 Insider Preview build 26200.5651 released to DEV
by
joep517
18 hours, 44 minutes ago -
Windows 11 Insider Preview build 26120.4441 (24H2) released to BETA
by
joep517
18 hours, 45 minutes ago -
iOS 26,, MacOS 26 : Create your own AI chatbot
by
Alex5723
22 hours, 40 minutes ago -
New PC transfer program recommendations?
by
DaveBoston
1 hour, 55 minutes ago -
Windows 11 Insider Preview Build 22631.5545 (23H2) released to Release Preview
by
joep517
1 day, 2 hours ago -
Windows 10 Build 19045.6029 (22H2) to Release Preview Channel
by
joep517
1 day, 2 hours ago -
Best tools for upgrading a Windows 10 to an 11
by
Susan Bradley
15 hours, 5 minutes ago -
The end of Windows 10 is approaching, consider Linux and LibreOffice
by
Alex5723
12 hours, 27 minutes ago -
Extended Windows Built-in Disk Cleanup Utility
by
bbearren
4 hours, 2 minutes ago -
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
1 day, 21 hours ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
19 hours, 39 minutes ago -
System Restore and Updates Paused
by
veteran
2 days ago -
Windows 10/11 clock app
by
Kathy Stevens
1 day, 11 hours ago -
Turn off right-click draw
by
Charles Billow
2 days, 3 hours ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
2 days, 7 hours ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
1 day ago -
Master patch listing for June 10, 2025
by
Susan Bradley
2 days, 8 hours ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
1 day, 11 hours ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
2 days, 14 hours ago -
KB5060842 Issue (Minor)
by
AC641
1 day, 2 hours ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
2 days, 21 hours ago -
24H2 may not be offered June updates
by
Susan Bradley
1 day, 14 hours ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
3 days, 10 hours ago -
June 2025 updates are out
by
Susan Bradley
15 hours, 44 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.