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  

Query wants parameter value



 
 
Thread Tools Display Modes
  #1  
Old February 26th, 2010, 08:55 PM posted to microsoft.public.access.queries
Bob H[_4_]
external usenet poster
 
Posts: 161
Default Query wants parameter value

I have a tools database which been used for over 12 months on a network
at work. Just lately I have noticed that on the main tools query, when I
open it to do some filtering for locations or tools, I am asked for a
parameter. If I just click ok, and not enter anything, the query runs.
It didn't used to ask for a parameter, so I don't understand why it is
doing so now.
This query is used to select the different tool types from a combo box
in the main form, so I don't want to change anything that would stop the
selection working.

The SQL for the said query is below:

SELECT tblTools.ToolTypeID, tblTools.Manufacturer, tblTools.Product,
tblTools.Size, tblTools.[Lenght Size], tblTools.SWL, tblTools.Drive,
tblTools.Range, tblTools.Increment, tblTools.ManufSerialNo,
tblTools.SerialNo, tblTools.AssetNo, tblTools.MPSENo,
tblTools.LastTestDate, DateAdd([PeriodTypeID],[Freq],[LastTestDate]) AS
NextTestDate, tblTools.CertificateNo, tblTools.LocationID,
tblTools.Notes, tblTools.Calibrate, tblTools.DateAdded, tblTools.DateEdited
FROM tblToolType INNER JOIN tblTools ON tblToolType.ToolTypeID =
tblTools.ToolTypeID
WHERE (((tblTools.ToolTypeID)=[Forms]![Tools]![cboSelectToolType])) OR
((([Forms]![Tools]![cboSelectToolType])=0 Or
([Forms]![Tools]![cboSelectToolType]) Is Null));


Thanks
  #2  
Old February 26th, 2010, 09:44 PM posted to microsoft.public.access.queries
ghetto_banjo
external usenet poster
 
Posts: 325
Default Query wants parameter value

what is the name of the parameter that it asks for?
  #3  
Old February 26th, 2010, 11:26 PM posted to microsoft.public.access.queries
Bob H[_4_]
external usenet poster
 
Posts: 161
Default Query wants parameter value

ghetto_banjo wrote:
what is the name of the parameter that it asks for?


Forms!Tools!cboSelectToolType
  #4  
Old March 1st, 2010, 01:37 PM posted to microsoft.public.access.queries
ghetto_banjo
external usenet poster
 
Posts: 325
Default Query wants parameter value

if you run the query and your "Tools" form is closed, it will always
ask for that parameter. If it still asks for the parameter when the
form is open, make sure the name of the control, cboSelectToolType, is
the exact same in the query and on the form.
  #5  
Old March 1st, 2010, 04:59 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default Query wants parameter value

If you run the query on CurrentDb, rather than using it, say, as record
source of a form, then you have to resolve the reference to that parameter
by yourself, by first opening a queryDef object, and then, for each of its
parameter in Parameters collection, assign a value to the parameter.

Dim qdf As QueryDef : Set qdf = CurrentDb.QueryDefs("queryName")
Dim param As DAO.Parameter
For each param in qdf.Parameters
param.value = eval(param.name) ' only as EXAMPLE
Next param
Dim rst as DAO.Recordset
Set rst = qdf.OpenRecordset( ... options... )
' not: = CurrentDb.OpenRecordset("queryName", ... options... )



Vanderghast, Access MVP


"Bob H" wrote in message
...
ghetto_banjo wrote:
what is the name of the parameter that it asks for?


Forms!Tools!cboSelectToolType


 




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 03:56 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.