简体   繁体   中英

Removing prompt for parameter on subform when added to navigation form in MS Access

I am creating a database with interface to keep track of student data for a school.

The particular issue I am having is on a form which modifies student data, specifically a sub form which shows classes which the student has been assigned to. The form (with sub-form) is shown below (red arrow indicates the sub-form):

用子表格修改学生

The sub-form gets its data from a query which uses a parameter from the main form (the MIS_ID field). The query is below:

SELECT classes.classCode, subjects.subjectCode
FROM (subjects INNER JOIN classes ON subjects.[subjectID] = classes.[subjectID]) 
INNER JOIN studentClasses ON classes.[classID] = studentClasses.[classID]
WHERE (((studentClasses.MIS_ID)=[Forms]![modifyStudent]![MIS_ID])); 

This all works fine, until I add this form to a navigation form tab. Once I do this, when I try to open the navigation form, I get the following prompt:

提示输入参数

This prompt does not appear when I just open the main Modify Student form. Also, strangely enough, if I open the Modify Student form first, and then open the Navigation form - the prompt does not appear.

How can I prevent Access from displaying this prompt. My MS access skills are not fantastic, so simple explanations would help.

Thanks!

Just to answer your question "Why this is not working in Navigation-form" navigation control has a "navigationsubform" control where your forms will be loaded. this means your master form (modifyStudent) is loaded into the "NavigationSubform" form control hence the original form name (ModifyStudent) is not reachable.

to access the parent value from your sub-form you could either use

 me.parent!field.value

or

NavigationForm.NavigationSubform.field.value

alternatively just bind the master and child forms using linkMasterFiled and linkChildField.

OR if you really want to construct the SQL: do in in the sub-form_onOpen event and assign it to the me.recordSource this way you can access me.Parent.Field.value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM