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.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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
-
Just got this pop-up page while browsing
by
Alex5723
26 minutes ago -
KB5058379 / KB 5061768 Failures
by
crown
8 hours, 42 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
11 hours, 21 minutes ago -
At last – installation of 24H2
by
Botswana12
12 hours, 5 minutes ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
1 hour, 43 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
1 day ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
17 hours, 37 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
1 day, 13 hours ago -
Another test post
by
gtd12345
1 day, 13 hours ago -
Connect to someone else computer
by
wadeer
1 day, 8 hours ago -
Limit on User names?
by
CWBillow
1 day, 11 hours ago -
Choose the right apps for traveling
by
Peter Deegan
1 day, 1 hour ago -
BitLocker rears its head
by
Susan Bradley
9 hours, 18 minutes ago -
Who are you? (2025 edition)
by
Will Fastie
8 hours, 15 minutes ago -
AskWoody at the computer museum, round two
by
Will Fastie
1 day, 3 hours ago -
A smarter, simpler Firefox address bar
by
Alex5723
2 days ago -
Woody
by
Scott
2 days, 9 hours ago -
24H2 has suppressed my favoured spider
by
Davidhs
8 hours, 55 minutes ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
2 days, 23 hours ago -
MS Office 365 Home on MAC
by
MickIver
2 days, 17 hours ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
3 days, 13 hours ago -
Flash Drive Eject Error for Still In Use
by
J9438
8 hours, 39 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
4 days, 8 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
4 days, 8 hours ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
3 days, 12 hours ago -
Migrate off MS365 to Apple Products
by
dmt_3904
3 days, 13 hours ago -
Login screen icon
by
CWBillow
3 days, 3 hours ago -
AI coming to everything
by
Susan Bradley
18 hours, 7 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
5 days ago -
No Screen TurnOff???
by
CWBillow
57 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.