A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using a parameter



 
 
Thread Tools Display Modes
  #1  
Old February 13th, 2010, 12:46 AM posted to microsoft.public.access.queries
PeterM
external usenet poster
 
Posts: 208
Default Using a parameter

I have a form (FormA) which has a subform(FormB). One of the listboxes on
FormB uses a query using a field from FormB as part of the where statement.
I've tried various versions of [forms]![FormA]![FormB].Form![PD_Date]
in the where statement. The query prompts for the value and if I enter it,
the query runs fine. When I try to run it on FormB, it prompts for the
value.

Can anyone let me know what I'm doing wrong?
  #2  
Old February 13th, 2010, 07:06 PM posted to microsoft.public.access.queries
Ken Snell
external usenet poster
 
Posts: 177
Default Using a parameter

Likely the name of the subform control that is holding "FormB" as the
subform is not named FormB. Open your main form in design view, click on the
top edge of the subform control that is holding FormB as the subform, open
Properties window, click on Name tab, and see what the name of the subform
control is. Use that name instead of FormB in the reference.


--

Ken Snell
http://www.accessmvp.com/KDSnell/


"PeterM" wrote in message
...
I have a form (FormA) which has a subform(FormB). One of the listboxes on
FormB uses a query using a field from FormB as part of the where
statement.
I've tried various versions of [forms]![FormA]![FormB].Form![PD_Date]
in the where statement. The query prompts for the value and if I enter
it,
the query runs fine. When I try to run it on FormB, it prompts for the
value.

Can anyone let me know what I'm doing wrong?



  #3  
Old February 13th, 2010, 11:09 PM posted to microsoft.public.access.queries
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Using a parameter

If the list box is in FormB and the control being referenced as the parameter
is also in FormB you shouldn't need to reference the parent form at all. The
following should work whether FormB is opened directly or as a subform:

Form![PD_Date]

In fact simply referencing the control by name should work:

[PD_Date]

but I prefer to qualify it with the Form property to avoid any possible
ambiguity as to what is being referenced.

Ken Sheridan
Stafford, England

PeterM wrote:
I have a form (FormA) which has a subform(FormB). One of the listboxes on
FormB uses a query using a field from FormB as part of the where statement.
I've tried various versions of [forms]![FormA]![FormB].Form![PD_Date]
in the where statement. The query prompts for the value and if I enter it,
the query runs fine. When I try to run it on FormB, it prompts for the
value.

Can anyone let me know what I'm doing wrong?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.