473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

unbound subform not working correctly

I have a form (Worksheet) that works fine by itself. I have now created a
seperate form (MainForm) that has a command button in the header and an
unbound subform (FormFrame) in the Detail section. when the user clicks the
command button, Worksheet is loaded into the subform control. At this point,
some of the functions do not work. The user is prompted to enter a Parameter
Value. Why wouldn't that form (Worksheet) work the same as a sub form? There
are no controls from or references to anthing on Worksheet on the MainForm
form, other than loading it from the command button. What am I not
understanding?
May 28 '06 #1
8 8296
"Robert" <no**@email.com> wrote in
news:kl********************@fe03.news.easynews.com :
I have a form (Worksheet) that works fine by itself. I have
now created a seperate form (MainForm) that has a command
button in the header and an unbound subform (FormFrame) in the
Detail section. when the user clicks the command button,
Worksheet is loaded into the subform control. At this point,
some of the functions do not work. The user is prompted to
enter a Parameter Value. Why wouldn't that form (Worksheet)
work the same as a sub form? There are no controls from or
references to anthing on Worksheet on the MainForm form, other
than loading it from the command button. What am I not
understanding?

When a form is married into a main form, she looses her maiden name
and becomes known as Form!mainformname!controlname

Somewhere in the query that you are using as source for the
subform is a reference to its name, which is no longer valid.

--
Bob Quintal

PA is y I've altered my email address.
May 28 '06 #2
This fixed part of the problem. I changed all of the references in the
underlying query to Forms!MainFormName!ControlName and I no longer get that
error, but I alos don't get the results I'm supposed to. What happens on the
form is, user selects a client name in a combo box which triggers a second
combo box of projects to display open projects for that client. On the
original form this worked but now, with the change to the query's criteria,
nothing appears in the list of projects. I am assuming that any references
in the code for these controls to "Me!ControlName.method" would still be
accurate and not need to be renamed.

"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:kl********************@fe03.news.easynews.com : When a form is married into a main form, she looses her maiden name
and becomes known as Form!mainformname!controlname

Somewhere in the query that you are using as source for the
subform is a reference to its name, which is no longer valid.

--
Bob Quintal

PA is y I've altered my email address.

May 28 '06 #3
"Robert" <no**@email.com> wrote in
news:Ii*****************@fe09.news.easynews.com:
This fixed part of the problem. I changed all of the
references in the underlying query to
Forms!MainFormName!ControlName and I no longer get that error,
but I alos don't get the results I'm supposed to. What happens
on the form is, user selects a client name in a combo box
which triggers a second combo box of projects to display open
projects for that client. On the original form this worked but
now, with the change to the query's criteria, nothing appears
in the list of projects. I am assuming that any references in
the code for these controls to "Me!ControlName.method" would
still be accurate and not need to be renamed.

those references using me. should still work. Without careful
examination of the code and the queries, it's difficult to say
what the problem is, but I have built several working unbound
forms with cascading comboboxes that filter a subform
"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:kl********************@fe03.news.easynews.com :

When a form is married into a main form, she looses her
maiden name and becomes known as
Form!mainformname!controlname

Somewhere in the query that you are using as source for the
subform is a reference to its name, which is no longer valid.

--
Bob Quintal

PA is y I've altered my email address.



--
Bob Quintal

PA is y I've altered my email address.
May 28 '06 #4
Bob Quintal wrote:
When a form is married into a main form, she looses her maiden name
and becomes known as Form!mainformname!controlname


Grumpy old men do not use this archaic and ugly naming convention. They
ensure the form has a module (code) and happily refer to it as
Form_FormName, and to its properties and events as
Form_FormName.PropertyorEvent anywhere, anytime.

May 29 '06 #5
OK, here are the details that seem relevent to me. I have poured over the
various controls and code and can't find anything that seems wrong, so I can
only assume that there is either a glaring error that is to obvious for me
to see, or a minor detail that I am not knowlegable enough to spot...

My main form [frmMainMenu] has a header with a series of command buttons,
the relevent one being [WorksheetButton]. The form detail contains two
unbound subforms, one named [FormFrame] the other [SecondaryFormFrame]. When
the user clicks [WorksheetButton], the SourceObject of [FormFrame] is set to
[frmWorksheet]:

Me!FormFrame.SourceObject = "frmWorksheet"

On the subform - [frmWorksheet] there is a header with two combo box
controls. The first is [SelectClient] which is populated from a query
"qryClientList":

SELECT tblClients.Client, tblClients.ClientID, tblClients.HomePhone,
tblClients.OfficePhone, tblClients.CellPhone,
tblClients.Location FROM tblClients ORDER BY tblClients.Client;

This combo contains a list of all the clients from "tblClients". Once a user
selects a client, the OnUpdate event triggers:

Me!SelectProject.Enabled = True
Me!SelectProject.Requery
EnableControls Me, acDetail, False

This enables the second combo box control [SelectProject] and is supposed to
populate it with a list of projects associated with the client chosen in the
first combo. The datasource is a query "qryProjectsByClient":

SELECT tblProjects.Project, tblProjects.ProjectID, tblProjects.ClientID,
tblProjects.Status
FROM tblProjects WHERE
(((tblProjects.ClientID)=[Forms]![frmMainMenu]![SelectClient]) AND
((tblProjects.Status) ="Pending" Or (tblProjects.Status)="In
Progress"));

Problem is, I see the list of clients in the SelectClient control, I select
a name and the screen flickers (as it does when it requeries) but nothing
appears in the SelectProject control. I don't thing it ever gets to this
point but, the AfterUpdate event for the SelectProject controls is:

DoCmd.ApplyFilter , "ProjectID = Forms!frmMainMenu!SelectProject"
EnableControls Me, acDetail, True
Me!ProjectID.Enabled = False

When I had this form open as a stand alone form (before I changed the form
references in "qryProjectsByClient" and the AfterUpdate event, these events
worked perfectly. I have checked all of the code in frmWorksheet and all of
the datasources and there is no other references to "frmWorksheet" that I
can find.

Do you see something in the code above that could present a problem? or is
there someplace else that I should look? I am afraid that I have tapped out
my pool of knowledge, so any help would be greatly appreciated.

"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn*********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:Ii*****************@fe09.news.easynews.com:

those references using me. should still work. Without careful
examination of the code and the queries, it's difficult to say
what the problem is, but I have built several working unbound
forms with cascading comboboxes that filter a subform

May 29 '06 #6
"Robert" <no**@email.com> wrote in
news:lz********************@fe04.news.easynews.com :
OK, here are the details that seem relevent to me. I have
poured over the various controls and code and can't find
anything that seems wrong, so I can only assume that there is
either a glaring error that is to obvious for me to see, or a
minor detail that I am not knowlegable enough to spot...

My main form [frmMainMenu] has a header with a series of
command buttons, the relevent one being [WorksheetButton]. The
form detail contains two unbound subforms, one named
[FormFrame] the other [SecondaryFormFrame]. When the user
clicks [WorksheetButton], the SourceObject of [FormFrame] is
set to [frmWorksheet]:

Me!FormFrame.SourceObject = "frmWorksheet"

On the subform - [frmWorksheet] there is a header with two
combo box controls. The first is [SelectClient] which is
populated from a query "qryClientList":

SELECT tblClients.Client, tblClients.ClientID,
tblClients.HomePhone,
tblClients.OfficePhone, tblClients.CellPhone,
tblClients.Location FROM tblClients ORDER BY
tblClients.Client;

This combo contains a list of all the clients from
"tblClients". Once a user selects a client, the OnUpdate event
triggers:

Me!SelectProject.Enabled = True
Me!SelectProject.Requery
EnableControls Me, acDetail, False

This enables the second combo box control [SelectProject] and
is supposed to populate it with a list of projects associated
with the client chosen in the first combo. The datasource is a
query "qryProjectsByClient":

SELECT tblProjects.Project, tblProjects.ProjectID,
tblProjects.ClientID,
tblProjects.Status
FROM tblProjects WHERE
(((tblProjects.ClientID)=[Forms]![frmMainMenu]![SelectClient])
AND ((tblProjects.Status) ="Pending" Or
(tblProjects.Status)="In Progress"));
well, if I understand the hiearchy, SelectClient isn't on the
parent form directly.but in the frmframe control.

This implies it is: [Forms]![frmMainMenu]![SelectClient]

Its fully qualified name is
Forms![frmMainMenu]![frmframe].form![SelectClient] (unwrap the
line if necessary)

Hope this helps.

Problem is, I see the list of clients in the SelectClient
control, I select a name and the screen flickers (as it does
when it requeries) but nothing appears in the SelectProject
control. I don't thing it ever gets to this point but, the
AfterUpdate event for the SelectProject controls is:

DoCmd.ApplyFilter , "ProjectID =
Forms!frmMainMenu!SelectProject" EnableControls Me,
acDetail, True Me!ProjectID.Enabled = False

When I had this form open as a stand alone form (before I
changed the form references in "qryProjectsByClient" and the
AfterUpdate event, these events worked perfectly. I have
checked all of the code in frmWorksheet and all of the
datasources and there is no other references to "frmWorksheet"
that I can find.

Do you see something in the code above that could present a
problem? or is there someplace else that I should look? I am
afraid that I have tapped out my pool of knowledge, so any
help would be greatly appreciated.

"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn*********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:Ii*****************@fe09.news.easynews.com:

those references using me. should still work. Without careful
examination of the code and the queries, it's difficult to
say what the problem is, but I have built several working
unbound forms with cascading comboboxes that filter a subform


--
Bob Quintal

PA is y I've altered my email address.
May 29 '06 #7
Ok, changing that syntax in the query worked. I'm not entirely sure why the
change was needed but we can get to that later.

Now the SelectProject list is populated correctly, however, once I make a
selection I get an error: Runtime error 2491 which says that the action is
invalid because the form isnt open or isnt based on a table or query. THis
is correct if it is refering to the main form (frmMainMenu) but not the
subform (frmWorksheet) which is based on tblProjects with the filter:

ProjectID = Forms!frmMainMenu!SelectProject

I tried to change that to the syntax you provided earlier but to no avail.
Also, upon debugging the error, Access hightlights the following line of
code in the AfterUpdate event of SelectProject:

DoCmd.ApplyFilter , "ProjectID = Forms!frmMainMenu!SelectProject"

I tried changing the syntax of this line also with no success.

When I'm in the code editor, if I press the Go button I get another runtime
error - 2488 "You cant use the ApplyFilter action on this window". I'm not
sure what this is about.

It seems as though Access is telling me that I need to have my main form
based on a table. I am confused however, because the main form does not
actually use any information, it is simply a means for display. Can I/Should
I just base the form on a table or query such as tblProjects like the
subform is but not use any controls from that table in the main form? As a
side note, at a future time, I am planning to develop a timecard application
that would concievably be loaded into that same FormFrame subform. Would
setting frmMainMenu's recordsource to tblProjects cause trouble when I do
create the timecard feature?

Robert

P.S. thanks for the patience!


"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:lz********************@fe04.news.easynews.com :

well, if I understand the hiearchy, SelectClient isn't on the
parent form directly.but in the frmframe control.

This implies it is: [Forms]![frmMainMenu]![SelectClient]

Its fully qualified name is
Forms![frmMainMenu]![frmframe].form![SelectClient] (unwrap the
line if necessary)

Hope this helps.

May 29 '06 #8
"Robert" <no**@email.com> wrote in
news:Oz*******************@fe09.news.easynews.com:
Ok, changing that syntax in the query worked. I'm not entirely
sure why the change was needed but we can get to that later.
Understanding why it works is key in helping you find/fix your
other problems. Basically, every object in Access fits in to a
hierarchy. At the top is the .application. beneath that are the
collections of tables, queries, forms, reports and modules.
Controls: Textboxes, listboxes, etc, labels and such are below
those.
Forms and reports can have subforms and subreports. Those are
also controls.

The name of an object is the nested path down through the
hiearchy. The first part is Forms, then comes the actual name of
the form. Next is the property or the control

Forms![frmMainMenu]![frmframe] is the reference to the subform
control. Adding the.form after lets us a reference the subform
properties, and objects. Then we specify which control on the
subform, then we would specify the property of that control we
want to examine, say forecolor or value. Value is the defauklt
property so leaving it off the list gives us the same result as
adding it.

Forms![frmMainMenu]![frmframe].form![SelectProject].value
Now the SelectProject list is populated correctly, however,
once I make a selection I get an error: Runtime error 2491
which says that the action is invalid because the form isnt
open or isnt based on a table or query. THis is correct if it
is refering to the main form (frmMainMenu) but not the subform
(frmWorksheet) which is based on tblProjects with the filter:

ProjectID = Forms!frmMainMenu!SelectProject
Well, the line above *is* pointing to the unbound form, so it's
a valid error.

Where is the above line? if it's in the
SelectProject_afterUpdate Event, it should work.
You could also try using the Me. prefix, which in a form or
subform, refers to the current level.

ProjectID = me.SelectProject

If it's in the query, you need to use the long version because
me. would be referring to the query,
I tried to change that to the syntax you provided earlier but
to no avail. Also, upon debugging the error, Access
hightlights the following line of code in the AfterUpdate
event of SelectProject:

DoCmd.ApplyFilter , "ProjectID =
Forms!frmMainMenu!SelectProject"

I tried changing the syntax of this line also with no success.
try the Me.SelectProject again.
When I'm in the code editor, if I press the Go button I get
another runtime error - 2488 "You cant use the ApplyFilter
action on this window". I'm not sure what this is about.
Neither do I at this instance, probably because the code is
pointing to a property on the mainform which has no records to
filter instead of the subform you are trying to set it on.
It seems as though Access is telling me that I need to have my
main form based on a table. I am confused however, because the
main form does not actually use any information, it is simply
a means for display. Can I/Should I just base the form on a
table or query such as tblProjects like the subform is but not
use any controls from that table in the main form? As a side
note, at a future time, I am planning to develop a timecard
application that would concievably be loaded into that same
FormFrame subform. Would setting frmMainMenu's recordsource to
tblProjects cause trouble when I do create the timecard
feature?
Doing that would be counterproductive. You can figure it out,
and get it to work. As the wise old man said: "Patience,
Grasshopper!"

Robert

P.S. thanks for the patience!


"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
"Robert" <no**@email.com> wrote in
news:lz********************@fe04.news.easynews.com :

well, if I understand the hiearchy, SelectClient isn't on the
parent form directly.but in the frmframe control.

This implies it is: [Forms]![frmMainMenu]![SelectClient]

Its fully qualified name is
Forms![frmMainMenu]![frmframe].form![SelectClient] (unwrap
the line if necessary)

Hope this helps.



--
Bob Quintal

PA is y I've altered my email address.
May 30 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Deborah V. Gardner | last post by:
I am using Access 97 and have had a problem joining a main form and a subform. I have a main form and a subform. The data source on the main form is a SELECT statement referring to three tables....
3
by: Dos Lil | last post by:
I have a unbound field in the subform(for calculating the datediff) which has the control property ==DateDiff("n",,). I have another unbound field in the main form which is for displaying the...
2
by: Simon P | last post by:
Hello group, I'm in desperate need of help. Here goes : I have the following tables : CONTACTS (ContactID, FirstName, LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS...
0
by: MeganF via AccessMonster.com | last post by:
hi. i have a mainform with customer information that has a subform and is linked by a custID. that works. there are 3 ther fields on the subform. the subform has a table record source with only...
2
by: Susan Bricker | last post by:
Greetings! Still the same application (as previous posts). I worked on the app while at work (don't tell my boss ... cause this is just for fun and not work related) and the form was working,...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
1
by: planetthoughtful | last post by:
Hi All, I have a mainform with a subform in which I show some task summary data. On the mainform I have a number of unbound controls that reflect values relevant to each task in the subform....
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.