In Access 97,I have database with a Main form which includes a subform generated from a query. The setup is similar to the Northwind Orders Db, with a Details table to hold linking info.
I want to place a button on another form to open my Main form to a specific record. The button wizard guided me through all the steps and I thought I was done. But, when I click the button, I receive 2 consecutive requests to enter parameter values. The first one wants KeyField.MainForm, the second Keyfield.Details. I have no idea how to alter the VBA code to accomplish this behind the scenes, or even what parameters I’m supposed to enter. Is there a simple way to fix this? I don’t care if the form opens filtered to the single record or opens all records with the focus on the correct one.
![]() |
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 |
-
Open Form & SubForm
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Open Form & SubForm
- This topic has 15 replies, 5 voices, and was last updated 24 years, 3 months ago.
AuthorTopicWSwtl3
AskWoody LoungerFebruary 14, 2001 at 4:56 pm #352912Viewing 2 reply threadsAuthorReplies-
WSThreeCrow
AskWoody LoungerFebruary 14, 2001 at 7:04 pm #514654 -
WSThreeCrow
AskWoody Lounger -
WSwtl3
AskWoody LoungerFebruary 14, 2001 at 8:59 pm #514668Hi John,
The parameter values its requesting are definitely not part of the query, I believe are they are the Child and Master links between the Main form and SubForm. Also, a button to simply OpenForm works fine. Its just opening to a specific record that’s a problem and the Wizard wrote the code.
Is there a way to tell the OpenForm what these parameters are in the arguments? And why do I need to tell it?
P.S. Using a Macro does the same thing. -
WSwtl3
AskWoody Lounger -
WSalpi
AskWoody Lounger -
WSwtl3
AskWoody LoungerFebruary 15, 2001 at 2:15 am #514703Good try, but that’s not it. Everything seems to be set properly and the form opens normally fully populated with subform data as it should.
When I go into the Northwinds sample database and add a button to do the same thing as in mine, it works fine.
I know I’m missing some simple little thing, as you suggest, but in comparing my Db with the sample and in checking for errors I’m not finding it. -
WScharlotte
AskWoody LoungerFebruary 15, 2001 at 3:11 am #514708Well, unless your form, table, field and query names are exactly the same as the Northwinds sample, you aren’t doing exactly the same thing. So let’s start with a few questions:
1. Is the form already open–i.e., you’re trying to change the current record from another form or the main form is hidden and you want to unhide it and change the record?
2. Post the code behind the command button so we can see what’s wrong with it. There are several ways to do what you’re trying to do, but we need to know which way you chose in order to suggest corrections.
3. Is your KeyField field actually on the form, or is it only in the form’s recordset?
4. If the Keyfield is actually bound to a control on the form, what is the name of the control. You can confuse Access thoroughly by naming your control and your field the same thing.
-
WSwtl3
AskWoody LoungerFebruary 15, 2001 at 3:54 am #514711Hi Charlotte,
1. The form I’m trying to open is closed.
2. Here is the code that the button wizard wrote:Dim stDocName As String
Dim stLinkCriteria As StringstDocName = “ECN Form”
stLinkCriteria = “[IDNumber]=” & Me![IDNumber]DoCmd.OpenForm stDocName, , , stLinkCriteria
3. The fields for both forms are the same and on the form. The one I want to open has it as a key field. The one I’m opening it from, does not.
4. I’m not clear on this question. The name of the Form field is [IDNumber] the name of the Table field is [IDNumber]. This was done by the Access form wizard. Aren’t a control and a form field the same thing? -
WScharlotte
AskWoody LoungerFebruary 15, 2001 at 7:44 am #514726On question 4, you have to realize that the wizard is stupid and is still writing Access 95 code, so don’t expect too much from it. No, the fields and the controls ase NOT the same, although Microsoft seems to ignore that fact to avoid “forcing” naming conventions on developers! You need to change the control names to things like txtIDNumber when it’s a textbox bound to the IDNumber field, in order to avoid confusing Access. Otherwise, calculated controls may wind up displaying #ERROR messages instead of values. In your case, make it …
stLinkCriteria = “[IDNumber]=” & Me![txtIDNumber]
and see if that makes a difference.
-
WSwtl3
AskWoody LoungerFebruary 15, 2001 at 3:23 pm #514779I assume you mean that a text box on a table is a field and a text box on a form is a control? Do I have the terminology correct now?
Changing the name does not help. Even replacing the name with an actual specific record value does not change the response.
i.e. stLinkCriteria = “[IDNumber]=3”
I still can’t help thinking that it has something to do with the way the Main form and subform are linked because (as stated in the first post) it is asking for parameter values for the link (fields or controls) for the two (forms or tables).
But what do I know?
The Main form was originally wizard generated. Then I looked at Northwind to see how to do the subform thing. I probably missed something. Although everything seems to work fine except for this.
-
-
-
-
WSBrian Swann
AskWoody LoungerFebruary 15, 2001 at 5:38 pm #514793[indent]
The first one wants KeyField.MainForm, the second Keyfield.Details.
[/indent] This sounds very much like an incorrect Child/Master parameter error. In the subform properties are the child and master set to KeyField and if so, is there a field on the main and subform named KeyField? Sorry if this sounds simplistic but sometimes simple answers are the best.
-
WSwtl3
AskWoody LoungerFebruary 15, 2001 at 8:46 pm #514820Oh boy! What’s the matter with Me!?
O.K. guys, sorry to make you all twist your brains for a neophyte like myself. Here’s what was happening. There was a procedure behind the form control [IDNumber]. That number was referenced by another control to concatenate letter characters onto it for another purpose. Both of these procedures were copied from other forms that have been in use for a couple of years. No problem, until I use them in a new form to which I add a subform. Now with the subform linked to the values entered to the table from those controls, when I try to do an OpenForn with LinkCriteria, Access gets confused.
Why? Because all the controls, fields and criteria values had the same name!
Simply adding Me! to the controls’ procedures alleviated the confusion. I have since gone through and renamed or qualified every identifier in the new database.
So, what’s wrong with Me!?
Nothing now, except possibly incurring the wrath of everyone whom I’ve frustrated in their attempts to help someone who thinks they’ve checked everything.
Yep, its always the simple stuff that’ll get you in the end.
Thank you everyone for all your thoughtful assistance. -
WSBrian Swann
AskWoody Lounger -
WSThreeCrow
AskWoody Lounger -
WSwtl3
AskWoody Lounger
-
-
Viewing 2 reply threads -

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
-
Meet Gemini in Chrome
by
Alex5723
40 minutes ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
48 minutes ago -
Trump signs Take It Down Act
by
Alex5723
8 hours, 47 minutes ago -
Do you have a maintenance window?
by
Susan Bradley
1 minute ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
3 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
12 hours, 7 minutes ago -
Help with WD usb driver on Windows 11
by
Tex265
17 hours, 16 minutes ago -
hibernate activation
by
e_belmont
21 hours, 2 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
1 day ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
1 day, 3 hours ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
1 day, 3 hours ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
31 seconds ago -
Out of band for Windows 10
by
Susan Bradley
1 day, 8 hours ago -
Giving UniGetUi a test run.
by
RetiredGeek
1 day, 15 hours ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 23 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
4 minutes ago -
Auto Time Zone Adjustment
by
wadeer
2 days, 3 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
2 days, 1 hour ago -
Manage your browsing experience with Edge
by
Mary Branscombe
51 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
18 hours, 24 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
1 day ago -
Apps included with macOS
by
Will Fastie
22 hours, 40 minutes ago -
Xfinity home internet
by
MrJimPhelps
19 hours, 27 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 day, 20 hours ago -
Debian 12.11 released
by
Alex5723
3 days ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
3 days, 4 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 days, 7 hours ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
15 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
3 days, 21 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
3 days, 11 hours 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.