parameter window pop up

C

ChrisC

Hi,

I have an unbound form on which I have 3 subforms. One of the subforms gets
its data from a query on a date. For the date field I have on the subform
Allan Browne's datepicker to choose the date. The chosen date is the
criteria for my query ([Forms]![frmProdTotDag]![txtStartDate]).

Now when I open my mainform with the 3 subforms I immediately get a popup
window asking me to enter the date.

How can I prevent this from happening because I don't always need that
subform but one of the others (depending on the data I want to collect from
my db).

All help's welcome.

Chris
 
D

Douglas J. Steele

To refer to a control on a subform, you must go via the parent form:

Forms![NameOfParentForm]![NameOfSubformControl].Form![NameOfControlOnSubform]

Depending on how you added the subform, the name of the subform control may
not be the same as the name of the form being used as a subform.
 
C

ChrisC

Hi Doug,

I tried [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] as you
suggested where frmProdTot is the main form on which there is the subform
frmProdTotDag (which is on a tab). In the frmProdTotDag there is a subform
sfrmProdTotDag that shows the result of the query.
The criteria for the query is a date that shows in a textfield txtStartDate
which is filled after the date selection in Allan Browne's datepicker. The
query should execute on the GotFocus event of the textfield (at least that's
what is does when I open the subform seperately).

The [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] is put in the
criteriafield of the date in the query on which sfrmPordTotDag is based.

I now no longer get the popup window asking me to fill in the date, but my
query no longer gives results.
What am I doing wrong?

Chris


Douglas J. Steele said:
To refer to a control on a subform, you must go via the parent form:

Forms![NameOfParentForm]![NameOfSubformControl].Form![NameOfControlOnSubform]

Depending on how you added the subform, the name of the subform control
may not be the same as the name of the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ChrisC said:
Hi,

I have an unbound form on which I have 3 subforms. One of the subforms
gets its data from a query on a date. For the date field I have on the
subform Allan Browne's datepicker to choose the date. The chosen date is
the criteria for my query ([Forms]![frmProdTotDag]![txtStartDate]).

Now when I open my mainform with the 3 subforms I immediately get a popup
window asking me to enter the date.

How can I prevent this from happening because I don't always need that
subform but one of the others (depending on the data I want to collect
from my db).

All help's welcome.

Chris
 
D

Douglas J. Steele

What's the SQL of the query?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ChrisC said:
Hi Doug,

I tried [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] as you
suggested where frmProdTot is the main form on which there is the subform
frmProdTotDag (which is on a tab). In the frmProdTotDag there is a subform
sfrmProdTotDag that shows the result of the query.
The criteria for the query is a date that shows in a textfield
txtStartDate which is filled after the date selection in Allan Browne's
datepicker. The query should execute on the GotFocus event of the
textfield (at least that's what is does when I open the subform
seperately).

The [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] is put in
the criteriafield of the date in the query on which sfrmPordTotDag is
based.

I now no longer get the popup window asking me to fill in the date, but my
query no longer gives results.
What am I doing wrong?

Chris


Douglas J. Steele said:
To refer to a control on a subform, you must go via the parent form:

Forms![NameOfParentForm]![NameOfSubformControl].Form![NameOfControlOnSubform]

Depending on how you added the subform, the name of the subform control
may not be the same as the name of the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ChrisC said:
Hi,

I have an unbound form on which I have 3 subforms. One of the subforms
gets its data from a query on a date. For the date field I have on the
subform Allan Browne's datepicker to choose the date. The chosen date is
the criteria for my query ([Forms]![frmProdTotDag]![txtStartDate]).

Now when I open my mainform with the 3 subforms I immediately get a
popup window asking me to enter the date.

How can I prevent this from happening because I don't always need that
subform but one of the others (depending on the data I want to collect
from my db).

All help's welcome.

Chris
 
C

ChrisC

Doug,

this is the SQL

SELECT qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling,
Avg(qryRptProdPersSumList.Percentage) AS AvgOfPercentage
FROM qryRptProdPersSumList
GROUP BY qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling
HAVING
(((qryRptProdPersSumList.datum)=[forms]![frmProdTot].[Form]![frmProdTotDag].[Form]![txtStartDate]));

Douglas J. Steele said:
What's the SQL of the query?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ChrisC said:
Hi Doug,

I tried [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] as you
suggested where frmProdTot is the main form on which there is the subform
frmProdTotDag (which is on a tab). In the frmProdTotDag there is a
subform sfrmProdTotDag that shows the result of the query.
The criteria for the query is a date that shows in a textfield
txtStartDate which is filled after the date selection in Allan Browne's
datepicker. The query should execute on the GotFocus event of the
textfield (at least that's what is does when I open the subform
seperately).

The [Forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] is put in
the criteriafield of the date in the query on which sfrmPordTotDag is
based.

I now no longer get the popup window asking me to fill in the date, but
my query no longer gives results.
What am I doing wrong?

Chris


Douglas J. Steele said:
To refer to a control on a subform, you must go via the parent form:

Forms![NameOfParentForm]![NameOfSubformControl].Form![NameOfControlOnSubform]

Depending on how you added the subform, the name of the subform control
may not be the same as the name of the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hi,

I have an unbound form on which I have 3 subforms. One of the subforms
gets its data from a query on a date. For the date field I have on the
subform Allan Browne's datepicker to choose the date. The chosen date
is the criteria for my query ([Forms]![frmProdTotDag]![txtStartDate]).

Now when I open my mainform with the 3 subforms I immediately get a
popup window asking me to enter the date.

How can I prevent this from happening because I don't always need that
subform but one of the others (depending on the data I want to collect
from my db).

All help's welcome.

Chris
 
J

John W. Vinson

Doug,

this is the SQL

SELECT qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling,
Avg(qryRptProdPersSumList.Percentage) AS AvgOfPercentage
FROM qryRptProdPersSumList
GROUP BY qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling
HAVING
(((qryRptProdPersSumList.datum)=[forms]![frmProdTot].[Form]![frmProdTotDag].[Form]![txtStartDate]));

PMFJI but I think I see the problem - there's an extra [Form]. Try

[forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate]

assuming that frmProdTotDag is the Name property of the Subform control (this
might be the same or different than the name of the form within that control).

You may also want to add

Parameters [forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate]
DateTime;

before the Select keyword.
 
C

ChrisC

John,
I changed the SQL but still no results when I try to execute the query with
the subform on the main form. Opening the subform on its own gives me a
popup window asking me for the date and gives me the correct result.
So again, this is the structure:

main form: frmProdTot (unbound)
on the main form: tab (TabCtl4) with 3 tabs (Maand, Week, Dag)
on the Dag tab: frmProdTotDag (source qryProdAfdTot)
SELECT qryProdAfdSum.weeknummer, qryProdAfdSum.Afdeling,
Avg(qryProdAfdSum.Percentage) AS AvgOfPercentage
FROM qryProdAfdSum
GROUP BY qryProdAfdSum.weeknummer, qryProdAfdSum.Afdeling;
in frmProdTotDag:
Allan Browne's Calendar
sfrmProdTotDag (source sqryProdAfdTotDag)
PARAMETERS
[forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate] DateTime;
SELECT qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling,
Avg(qryRptProdPersSumList.Percentage) AS AvgOfPercentage
FROM qryRptProdPersSumList
GROUP BY qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling
HAVING
(((qryRptProdPersSumList.datum)=[forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate]));

The objective is to choose a date in the Allan Brown's calender and get the
results of the query.

Chris


John W. Vinson said:
Doug,

this is the SQL

SELECT qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling,
Avg(qryRptProdPersSumList.Percentage) AS AvgOfPercentage
FROM qryRptProdPersSumList
GROUP BY qryRptProdPersSumList.datum, qryRptProdPersSumList.Afdeling
HAVING
(((qryRptProdPersSumList.datum)=[forms]![frmProdTot].[Form]![frmProdTotDag].[Form]![txtStartDate]));

PMFJI but I think I see the problem - there's an extra [Form]. Try

[forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate]

assuming that frmProdTotDag is the Name property of the Subform control
(this
might be the same or different than the name of the form within that
control).

You may also want to add

Parameters [forms]![frmProdTot]![frmProdTotDag].[Form]![txtStartDate]
DateTime;

before the Select keyword.
 

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

Top