Passing data from subform to a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 forms - Course Information, Course Sections, and Section
Information. Course Information is a main form and Course Sections is a
sub-form displayed on the main form. I am trying to allow my users to click
the section ID (displayed on the Course Sections sub-form) and open the
Secton Information form for the specific section ID selected.

I've built a macro which works when I try it using only the Course Sections
form. But when I try it from the Course Information form (actually, the
Course Sections form which is a sub-form on Course Information), it does not
work.

My macro has 4 actions:
Action Command
RunCommand Command: Select Record
OpenForm Form Name: frm_SectionInformation
View: Form
Where Condition:
[SectKey]=[Forms]![subfrm_CourseSections]![SectKey]
Data Mode: Edit
Window Mode: Normal
Close Object Type: Form
Object Name: frm_CourseInformation
Save: No
GoToControl Control Name: SectKey

As I said, this works fine if I have just subfrm_CourseSections open. If I'm
trying it via frm_CourseInformation, it bombs on me (prompts me for
"[subfrm_CourseSections]![SectKey]"). I'm sure this is one of those weird
subform things.

Any thoughts on how to get around this?

Thanks!
 
axw99 said:
I have 3 forms - Course Information, Course Sections, and Section
Information. Course Information is a main form and Course Sections is a
sub-form displayed on the main form. I am trying to allow my users to
click
the section ID (displayed on the Course Sections sub-form) and open the
Secton Information form for the specific section ID selected.

I've built a macro which works when I try it using only the Course
Sections
form. But when I try it from the Course Information form (actually, the
Course Sections form which is a sub-form on Course Information), it does
not
work.

My macro has 4 actions:
Action Command
RunCommand Command: Select Record
OpenForm Form Name: frm_SectionInformation
View: Form
Where Condition:
[SectKey]=[Forms]![subfrm_CourseSections]![SectKey]
Data Mode: Edit
Window Mode: Normal
Close Object Type: Form
Object Name: frm_CourseInformation
Save: No
GoToControl Control Name: SectKey

As I said, this works fine if I have just subfrm_CourseSections open. If
I'm
trying it via frm_CourseInformation, it bombs on me (prompts me for
"[subfrm_CourseSections]![SectKey]"). I'm sure this is one of those weird
subform things.

Any thoughts on how to get around this?

Thanks!
 
adsl said:
axw99 said:
I have 3 forms - Course Information, Course Sections, and Section
Information. Course Information is a main form and Course Sections is a
sub-form displayed on the main form. I am trying to allow my users to
click
the section ID (displayed on the Course Sections sub-form) and open the
Secton Information form for the specific section ID selected.

I've built a macro which works when I try it using only the Course
Sections
form. But when I try it from the Course Information form (actually, the
Course Sections form which is a sub-form on Course Information), it does
not
work.

My macro has 4 actions:
Action Command
RunCommand Command: Select Record
OpenForm Form Name: frm_SectionInformation
View: Form
Where Condition:
[SectKey]=[Forms]![subfrm_CourseSections]![SectKey]
Data Mode: Edit
Window Mode: Normal
Close Object Type: Form
Object Name: frm_CourseInformation
Save: No
GoToControl Control Name: SectKey

As I said, this works fine if I have just subfrm_CourseSections open. If
I'm
trying it via frm_CourseInformation, it bombs on me (prompts me for
"[subfrm_CourseSections]![SectKey]"). I'm sure this is one of those weird
subform things.

Any thoughts on how to get around this?

Thanks!
 
adsl said:
axw99 said:
I have 3 forms - Course Information, Course Sections, and Section
Information. Course Information is a main form and Course Sections is a
sub-form displayed on the main form. I am trying to allow my users to
click
the section ID (displayed on the Course Sections sub-form) and open the
Secton Information form for the specific section ID selected.

I've built a macro which works when I try it using only the Course
Sections
form. But when I try it from the Course Information form (actually, the
Course Sections form which is a sub-form on Course Information), it does
not
work.

My macro has 4 actions:
Action Command
RunCommand Command: Select Record
OpenForm Form Name: frm_SectionInformation
View: Form
Where Condition:
[SectKey]=[Forms]![subfrm_CourseSections]![SectKey]
Data Mode: Edit
Window Mode: Normal
Close Object Type: Form
Object Name: frm_CourseInformation
Save: No
GoToControl Control Name: SectKey

As I said, this works fine if I have just subfrm_CourseSections open. If
I'm
trying it via frm_CourseInformation, it bombs on me (prompts me for
"[subfrm_CourseSections]![SectKey]"). I'm sure this is one of those weird
subform things.

Any thoughts on how to get around this?

Thanks!
 
axw99 said:
I have 3 forms - Course Information, Course Sections, and Section
Information. Course Information is a main form and Course Sections is a
sub-form displayed on the main form. I am trying to allow my users to
click
the section ID (displayed on the Course Sections sub-form) and open the
Secton Information form for the specific section ID selected.

I've built a macro which works when I try it using only the Course
Sections
form. But when I try it from the Course Information form (actually, the
Course Sections form which is a sub-form on Course Information), it does
not
work.

My macro has 4 actions:
Action Command
RunCommand Command: Select Record
OpenForm Form Name: frm_SectionInformation
View: Form
Where Condition:
[SectKey]=[Forms]![subfrm_CourseSections]![SectKey]
Data Mode: Edit
Window Mode: Normal
Close Object Type: Form
Object Name: frm_CourseInformation
Save: No
GoToControl Control Name: SectKey

As I said, this works fine if I have just subfrm_CourseSections open. If
I'm
trying it via frm_CourseInformation, it bombs on me (prompts me for
"[subfrm_CourseSections]![SectKey]"). I'm sure this is one of those weird
subform things.

Any thoughts on how to get around this?

Thanks!
 
Nothing weird about it, just a reference problem! You need to tell
Access where to find the subform, as it is opened as part of another
form, rather than on its own right. Change your Where condition to:


[SectKey]=[Forms]![Course Information]![subfrm_CourseSections]![SectKey]


HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top