Running Query on Subform

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

Guest

I have a form "frmMain" which has a subform "frmSub". On my subform I have a
date range field (that auto-populates to todays date, but can be changed)
then I have a button to run a query based on the date selected.

In my query I have the date field criteria set as
<>
<=([Forms]![frmSub]![txtDate])
<>

This is not working, I believe because I need to tell it that it is located
on frmMain & then on the frmSub. I am not sure how to do this.

If I open up the frmSub by itself the it will work fine, just when it is
apart of the frmMain.

Any ideas?
 
Hi, James.

It's kind of a strange syntax, to me at least:

=Forms![frmMain]![frmSub].Form![txtDate]

Hope that helps.
Sprinks
 
Hello all,

I am running into a similar issue, and I really thought this answer would
have solved my problem but I've tried 18 times and it still hasn't.

I've run into this before and solved it before, so please if anyone could
help me out it would be apprecaited.

My Form1's recordsource has an SQL statement that refers to a date range on
the form (txtstartdate and txtenddate) ... the form looks great and returns
data and all when I open it with txtstartdate being Date()-1 and txtenddate
being Date().

But I want to put Form1 onto another form now making it a subform.
So now when I open up ParentForm1 it is asking for the txtstartdate and
txtenddate of the subform.

Does anyone know what I mean? I've tried changing the reference to the
txtboxes in my sql statement from Form1 (now subForm1) that calls
txtstartdate and txtenddate like explained in this answer here... but no go.

Help please.
--
Jeff S - Canada


Sprinks said:
Hi, James.

It's kind of a strange syntax, to me at least:

=Forms![frmMain]![frmSub].Form![txtDate]

Hope that helps.
Sprinks

James C. said:
I have a form "frmMain" which has a subform "frmSub". On my subform I have a
date range field (that auto-populates to todays date, but can be changed)
then I have a button to run a query based on the date selected.

In my query I have the date field criteria set as
<>
<=([Forms]![frmSub]![txtDate])
<>

This is not working, I believe because I need to tell it that it is located
on frmMain & then on the frmSub. I am not sure how to do this.

If I open up the frmSub by itself the it will work fine, just when it is
apart of the frmMain.

Any ideas?
 
Hello all,

I am running into a similar issue, and I really thought this answer would
have solved my problem but I've tried 18 times and it still hasn't.

I've run into this before and solved it before, so please if anyone could
help me out it would be apprecaited.

My Form1's recordsource has an SQL statement that refers to a date range on
the form (txtstartdate and txtenddate) ... the form looks great and returns
data and all when I open it with txtstartdate being Date()-1 and txtenddate
being Date().

But I want to put Form1 onto another form now making it a subform.
So now when I open up ParentForm1 it is asking for the txtstartdate and
txtenddate of the subform.

Does anyone know what I mean? I've tried changing the reference to the
txtboxes in my sql statement from Form1 (now subForm1) that calls
txtstartdate and txtenddate like explained in this answer here... but no go.

Help please.
--
Jeff S - Canada


Sprinks said:
Hi, James.

It's kind of a strange syntax, to me at least:

=Forms![frmMain]![frmSub].Form![txtDate]

Hope that helps.
Sprinks

James C. said:
I have a form "frmMain" which has a subform "frmSub". On my subform I have a
date range field (that auto-populates to todays date, but can be changed)
then I have a button to run a query based on the date selected.

In my query I have the date field criteria set as
<>
<=([Forms]![frmSub]![txtDate])
<>

This is not working, I believe because I need to tell it that it is located
on frmMain & then on the frmSub. I am not sure how to do this.

If I open up the frmSub by itself the it will work fine, just when it is
apart of the frmMain.

Any ideas?
 
Back
Top