SQL Select Query Prompting for NonExistent Parameter

I'm using Access 97.

I've entered the following SQL Query into the Query Tab.

===================

SELECT * FROM tblVehicles WHERE fldVehicleTag = ABC123;

====================

When I double click the Query to execute:

Instead of returning the recordset Access prompts me for
a Parameter.   When I enter the tag # --> ABC123
it returns the correct record.

Why am I being prompted for a Parameter and how do I stop it?

Thanks
David 


0
David
3/18/2010 2:25:13 AM
access.queries 6343 articles. 1 followers. Follow

8 Replies
973 Views

Similar Articles

[PageSpeed] 59

On Wed, 17 Mar 2010 22:25:13 -0400, "David" <NoWhere@earthlink.net> wrote:

>I'm using Access 97.
>
>I've entered the following SQL Query into the Query Tab.
>
>===================
>
>SELECT * FROM tblVehicles WHERE fldVehicleTag = ABC123;
>
>====================
>
>When I double click the Query to execute:
>
>Instead of returning the recordset Access prompts me for
>a Parameter.   When I enter the tag # --> ABC123
>it returns the correct record.
>
>Why am I being prompted for a Parameter and how do I stop it?
>
>Thanks
>David 

You need quotemarks around the text criterion:


SELECT * FROM tblVehicles WHERE fldVehicleTag = 'ABC123';

Criteria on Text fields must be delimited by ' or "; Date/Time fields must be
delimited by # (for date literals); Number or Currency fields use no
delimiter.


-- 

             John W. Vinson [MVP]
0
John
3/18/2010 2:43:07 AM
Thanks Mr. Vinson --  Worked GREAT!

One other followup.  Instead of SQL, I tried Access's
Query Designer (hope I have this name correct).
I entered the test Tag Number under Criteria.

Of interest, is that the Query returned the correct record
but with the fldVehicleTag column in the first position.
Anyone to replicate this in SQL or is this a field "reorder" function
that is part of Access?


"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message 
news:0n43q51gek1m51foi4o3fudgklg5kn9kop@4ax.com...
> On Wed, 17 Mar 2010 22:25:13 -0400, "David" <NoWhere@earthlink.net> wrote:
>
>>I'm using Access 97.
>>
>>I've entered the following SQL Query into the Query Tab.
>>
>>===================
>>
>>SELECT * FROM tblVehicles WHERE fldVehicleTag = ABC123;
>>
>>====================
>>
>>When I double click the Query to execute:
>>
>>Instead of returning the recordset Access prompts me for
>>a Parameter.   When I enter the tag # --> ABC123
>>it returns the correct record.
>>
>>Why am I being prompted for a Parameter and how do I stop it?
>>
>>Thanks
>>David
>
> You need quotemarks around the text criterion:
>
>
> SELECT * FROM tblVehicles WHERE fldVehicleTag = 'ABC123';
>
> Criteria on Text fields must be delimited by ' or "; Date/Time fields must 
> be
> delimited by # (for date literals); Number or Currency fields use no
> delimiter.
>
>
> -- 
>
>             John W. Vinson [MVP] 


0
David
3/18/2010 3:07:26 AM
On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> wrote:

>Thanks Mr. Vinson --  Worked GREAT!
>
>One other followup.  Instead of SQL, I tried Access's
>Query Designer (hope I have this name correct).
>I entered the test Tag Number under Criteria.

The query grid is simply a tool to construct SQL. The SQL is a) the real
query, and b) much easier to post and discuss on newsgroups.

>Of interest, is that the Query returned the correct record
>but with the fldVehicleTag column in the first position.
>Anyone to replicate this in SQL or is this a field "reorder" function
>that is part of Access?

The order of columns in the query grid should match the order of fieldnames in
the SQL SELECT clause, and should also control the order in which the fields
appear in the query grid. I'm not aware of any automagical reordering!
-- 

             John W. Vinson [MVP]
0
John
3/18/2010 3:24:34 AM
Thank you for your time.

Have a nice evening.

David

"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message 
news:6473q5hjj4mpf6oda5eg8kngu3pgq14l8r@4ax.com...
> On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> wrote:
>
>>Thanks Mr. Vinson --  Worked GREAT!
>>
>>One other followup.  Instead of SQL, I tried Access's
>>Query Designer (hope I have this name correct).
>>I entered the test Tag Number under Criteria.
>
> The query grid is simply a tool to construct SQL. The SQL is a) the real
> query, and b) much easier to post and discuss on newsgroups.
>
>>Of interest, is that the Query returned the correct record
>>but with the fldVehicleTag column in the first position.
>>Anyone to replicate this in SQL or is this a field "reorder" function
>>that is part of Access?
>
> The order of columns in the query grid should match the order of 
> fieldnames in
> the SQL SELECT clause, and should also control the order in which the 
> fields
> appear in the query grid. I'm not aware of any automagical reordering!
> -- 
>
>             John W. Vinson [MVP] 


0
David
3/18/2010 4:10:53 AM
On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> wrote:

>Of interest, is that the Query returned the correct record
>but with the fldVehicleTag column in the first position.
>Anyone to replicate this in SQL or is this a field "reorder" function
>that is part of Access?

My guess is that you got this result because you included both the
fldVehicleTag explicitly (for the criterion), and the * operator which returns
all fields. It probably put the field you specified first and then all the
other fields (or it may have included fldVehicleTag twice, aliasing one of
them as Expr1).

You can select all of the fields individually or as a group - select them all
from the field list and drag them to the grid, and leave off the *. You can
then arrange the fields in any order you like.
-- 

             John W. Vinson [MVP]
0
John
3/18/2010 5:10:12 AM
Ah, but you can rearrange columns in datasheet view and if you save the 
changes the Access will remember the changes to the datasheet view.

That doesn't explain the order the poster sees if he just opened a new query 
and used the "query designer"

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

John W. Vinson wrote:
> On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> wrote:
> 
>> Thanks Mr. Vinson --  Worked GREAT!
>>
>> One other followup.  Instead of SQL, I tried Access's
>> Query Designer (hope I have this name correct).
>> I entered the test Tag Number under Criteria.
> 
> The query grid is simply a tool to construct SQL. The SQL is a) the real
> query, and b) much easier to post and discuss on newsgroups.
> 
>> Of interest, is that the Query returned the correct record
>> but with the fldVehicleTag column in the first position.
>> Anyone to replicate this in SQL or is this a field "reorder" function
>> that is part of Access?
> 
> The order of columns in the query grid should match the order of fieldnames in
> the SQL SELECT clause, and should also control the order in which the fields
> appear in the query grid. I'm not aware of any automagical reordering!
0
John
3/18/2010 2:23:44 PM
John,

Good one.  I'll have to keep this in mind when I am answering questions.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

John W. Vinson wrote:
> On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> wrote:
> 
>> Of interest, is that the Query returned the correct record
>> but with the fldVehicleTag column in the first position.
>> Anyone to replicate this in SQL or is this a field "reorder" function
>> that is part of Access?
> 
> My guess is that you got this result because you included both the
> fldVehicleTag explicitly (for the criterion), and the * operator which returns
> all fields. It probably put the field you specified first and then all the
> other fields (or it may have included fldVehicleTag twice, aliasing one of
> them as Expr1).
> 
> You can select all of the fields individually or as a group - select them all
> from the field list and drag them to the grid, and leave off the *. You can
> then arrange the fields in any order you like.
0
John
3/18/2010 2:25:43 PM
Thanks Mr. Vinson and Mr. Spencer.

Problem resolved.

Appreciate your efforts on  my behalf.

Normally use SQL and Access as backend to VB, so not comfortable with "inter 
workings" of Access interface.   Need to allocate some time in that area.

 Have a nice day.

David

"John Spencer" <spencer@chpdm.edu> wrote in message 
news:OJ1umbqxKHA.5936@TK2MSFTNGP04.phx.gbl...
> John,
>
> Good one.  I'll have to keep this in mind when I am answering questions.
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
> John W. Vinson wrote:
>> On Wed, 17 Mar 2010 23:07:26 -0400, "David" <NoWhere@earthlink.net> 
>> wrote:
>>
>>> Of interest, is that the Query returned the correct record
>>> but with the fldVehicleTag column in the first position.
>>> Anyone to replicate this in SQL or is this a field "reorder" function
>>> that is part of Access?
>>
>> My guess is that you got this result because you included both the
>> fldVehicleTag explicitly (for the criterion), and the * operator which 
>> returns
>> all fields. It probably put the field you specified first and then all 
>> the
>> other fields (or it may have included fldVehicleTag twice, aliasing one 
>> of
>> them as Expr1).
>>
>> You can select all of the fields individually or as a group - select them 
>> all
>> from the field list and drag them to the grid, and leave off the *. You 
>> can
>> then arrange the fields in any order you like. 


0
David
3/20/2010 1:30:47 PM
Reply:

Similar Artilces:

like query using field name
Hi All I have a column 'staffnumber' (int) and another column 'Resourceid' (nvarchar) in a table in sql server 2005 express I want to do a query to find rows where the staffnumber value is not in the Resourceid field e.g select mydate, customerid from appointments where Resourceid not like '%[staffnumber value]%' in other words the 'staffnumber' column value for each row is NOT in the 'Resourceid' column value Can this be done? Regards Steve Steve declare @par nvarchar(20) set @par='staffnumber' select my...

Calling Dex Procedures from SQL
Is there any way to call dex procs from SQL or VB code? Jed There is an undocumented and unsupported method of calling Dex code from VBA. However, I know of no method of calling Dexterity from SQL. Please email me if you want an example, just remove the online. from the address below. David Musgrave [MSFT] Senior Development Consultant MBS Services - Asia Pacific Microsoft Business Solutions http://www.microsoft.com/BusinessSolutions mailto:dmusgrav@online.microsoft.com Any views contained within are my personal views and not necessarily Microsoft Business Solutions policy. This p...

is SQL 2000 architecture different SQL Server 2005 / 2008 architecture?
Hi I have a book "inside SQL Server 2000" by Kalen Delaney, which I have been told is a good book. I am going backwards... reading about the sql server architecture in chapter 3 of the book. As I'm reading... I was wondering is it different SQL Server 2000 vs SQL Server 2005/2008? Also where can I find a book/or link that can give me more details about the internals on architecture? Thank you norm (normanchan@gmail.com) writes: > Hi I have a book "inside SQL Server 2000" by Kalen Delaney, which I > have been told is a good book. I am g...

Group select view others' calendar outlook 2007
Is there some sort of shortcut to select/view a group of other peoples calender? Now I have to check the box of everyone, and then uncheck everyone when I only want to see my own calendar. see if http://www.publicshareware.com/outlook-public-calendar-choice.php does what you need. if not, google for AutoIt. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: EMO-NEWSLET...

Moving customizations from SQL 2k to SQL 2k5 CRM
This may be a non-issue but I wanted to check to see if anyone has done this and ran into issues. I have the XML customization files from our previous install of CRM 3.0 with SQL 2k database. I now want to import and publish these same customizations to CRM 3.0 on SQL 2k5. Has anyone done this or can point me to documentation that tells about the success or issues for doing this? Thanks. On 7 Feb., 06:35, Chris Treanor <ChrisTrea...@discussions.microsoft.com> wrote: > This may be a non-issue but I wanted to check to see if anyone has done this > and ran into issues. > &...

Listbox and multi-select and dropdown?
I need to have combo box capability with multi-select ability. I tried using listboxes, but the problem I have is they don't drop down so I can see only one listed item at a time. I cannot make the listboxes bigger. Is there any way to code a listbox to drop-down, maybe by manipulating the height property? If I could get the selected items to move to the top of the list it would be great also. Has anyone done this? I hate to re-invent the wheel. Thanks. On Oct 3, 12:46 pm, mscertified <rup...@tigerlily.com> wrote: > I need to have combo box capability with multi-select abil...

CRM 3.0 Install Error with SQL Reporting Services and SQL 2005
Hi, Doing a CRM 3.0 Server installation. During the last page of the install wizard (or what I assume is the last page) when I goes through and does verification I get a red X next to SQL Reporting Services. The message I receive when I look at the details is: ***** The specified path is not a metabase path. Parameter name: path ***** Now SRS is installed and working. I put in the URL: http://<servername>/reportserver and every other variation on that I can find. Thoughts? Alan try http://servername/reports also assuming you did not use ssl... =======================...

How can i create a query on text input to return closest match?
I would like to create a text based parameter which will return the closest match? e.g Drink is the search citeria, the search will look for the word drink in every record and bring up those with the closest match Can you explain what you mean by closest match? Looking for the word Drink in a field and returning all the records where "drink" is included in the field would be simple. Field: SomeFieldWithText Criteria: LIKE "*" & [Enter word] & "*" But if you wanted to enter DRINK and find Drink or Drank or Drunk or Dink or Rink Or Dunk or .... in...

SQL 'for xml' and C# example??
I'm missing some piece of the puzzle. I'm using 'for xml' type queries from SQL2K - and now trying to change the front-end from ADO to C#, I can't quite figure it out.. It seems that I could use an XmlReader.. and somehow use that instead of a DataReader.. but that didn't work.. I tried using a DataReader and get the byte array - but that wasn't right. SQL returns formatted XML, I need to load that XML into an XmlDocument somehow without ANY molestation of that dom. Any ideas? Examples? Missing links???? thanks THANKS!! I've been looking for the answer to ...

sql summarizing help
Hi All, Given: table1 --------- id, cdate, weeksago, amount, typeid, timeclose 496, 2010-02-11, 0, 450, 3, 1 490, 2010-02-01, 1, 200, 4, 1 491, 2010-02-01, 1, 350, 2, 2 493, 2010-02-01, 1, 500, 5, 1 489, 2010-01-21, 3, 150, 2, 1 136, 2010-01-12, 4, 500, 3, 2 137, 2010-01-12, 4, 100, 3, 1 138, 2010-01-12, 4, 500, 2, 1 1. i'm trying to create a sql that will give me a summary resultset grouped by weeksago. 2. i want to sum the columns and get counts based on typeid. 3. avg of timeclose here's the sql i have: select weeksago, , (sum(timeClose)/(count(timeclo...

amend a PO with a query? Please help!
Hello, Our new warehouse manager entered, received and committed a PO from the wrong vendor - over 100 items! Does anyone know a way to either reverse the PO or change the vendor? Please help!!!! Thank you! diana Diana, You can reverse the PO by opening it again in receiving mode. Use the Quick Scan button and add an item to the PO (any item). This will 'unlock' or re-open the PO. You can now delete the item you just added back off. Next you would enter the quantity 'Received to Date' of each item into the 'Quantity Received' column as a negative. Fo...

Insert AutoText entries based on selected options in UsrForm cbobo
Word 2003 on Windows XP. My template will be used to create design documents with up to 12 different sections ("sections" meaning blocks of text, no Section Breaks involved). Examples of sections are Requirements, Assumptions, Calculations, Examples, etc. I have defined AutoText entries for each of the variations that can occur for each of the sections. For example, there are AutoText entries for RequirementsA, RequirementsB, AssumptionsA, etc. Thanks to one of the MVP websites, I now have a userform with 12 comboboxes that list out all of the AutoText entries, so ...

Update multivalue field in table from form with SQL
Access 2007 on Vista I am using a form to establish the variables for a report before it is created. One field on the underlying table is a multivalue field, and the form includes a multi-select combo box control. After selections are made and the OK button on the multi-select combo drop down is clicked, focus moves to the next control. I have discovered though, that the underlying table does not update immediately, but does so correctly when I close the form. This sequence does not deliver the proper report data, so I need a way to immediately update the underlying table (m...

Print selected worksheets in multiple workbooks?
We would like to print two specific worksheets that exist in multiple workbooks at the same time. In other words, we would like to be able to select all workbook files in a directory and send to the printer to have the same two pages from each workbook print, not the entire workbook. We would like to avoid having to select each file individually to send two sheets to the printer, and then close and go on to the next file. Is this possible, and if so, how do we accomplish this? Thanks for any direction you can provide. I wasn't sure what all you needed, so the code below will ...

Combo values from query
I am setting the values for a combo box in a form(s) via a query that 'filters' the results with criteria based upon the vales of other fields on the form. The combo is a field that is bound. However, this is giving all kinds of problems ranging from Access completely crashing to being asked for the parameter values of those criteria fields when closing the form. I have tried making the combo an unbound field and then setting the value of the bound field to that unbound field after update, but that stilll leads to the same issues. How can I do this? As example - I have a form w...

Refer to SQL statements globally
I have two large SQL statements that I need to use across several forms, reports, etc. Rather than repeat them in each form, I'm trying to store and reference them globally. For example, I'd like to store strSQL1 and strSQL2 in a global module, so I can use either like this in a form: Random form: Me!lstResults.RowSource = strSQL1 Random report: Me.Report.RecordSource = strSQL2 Would I just store the SQL statements in a global module like: Public Function SQLSource() As String Dim strSQL1 As String Dim strSQL2 As String strSQL1 = "SELECT blah blah...

limit on new database query?
Hi I am trying to create an olap cube to export to another product, however when I use the new database query to bring the data into excel (from another excel table) I only get 1440 rows. Is there any reason or way to change this limitation? Thanks Doug ...

Excel + Query Tutorial Recommended?
Can anyone recommend a good little online tutorial so that I can get started with manipulating my excel SQL queries. I have managed so far to link up excel to the database and pull out a table, add in some criteria (ie dates etc), applied a sort field and refresh. However I want to understand a bit more about how to pull out two tables and link them together, and this is where (as a beginner) I am getting stuck. I do not need an intense SQL certification course or anything like that, just a tutorial about how to edit and manipulate SQL queries in excel. If anyone can point me in th...

To SQL or not to SQL?
I have a very vertical product developed 100% in M/S Access. I developed it myself in 1993 in the initial release of Access and been with it ever since. It is currently very stable and running in Access 2003. My big question is how or even *if* we should move it to SQL. My customers are getting bigger all the time with more users. Typically our customers run one or two workstations generally never more than 5. Performance, however, is starting to slow with database sizes passing 500 meg. We also have a LOT of code behind forms so are bound tightly to the Access development environ...

PostgreSQL or other SQL servers in RMS
Has anyone successfully implemented RMS with one of the free SQL servers? Theoretically, is there any reason why we have to use MS SQL Server 2000 for large databases? David "dh" <dh@discussions.microsoft.com> ha scritto nel messaggio news:1783A90D-AF3E-4D91-A445-0039D4E7E379@microsoft.com... > Has anyone successfully implemented RMS with one of the free SQL servers? > Theoretically, is there any reason why we have to use MS SQL Server 2000 > for > large databases? RMS has implemented only for MS SQL Server (2000/MSDE) and isn't possible to work with ano...

Combo Box Search By Query
Hi All, Ive Created a Dialog Box With some tick box's and a Combo Box. the Dialog box aint quite working the way i would like it to. the dialog box will open a report which the report has a record source of the query. the tick box on is ment to Included Projects that have Maintenance assigned. but the tick box is set to a yes or no. and the query looks at this field the combo box is the same, the combo lists all the end clients, and it works if i select a client which is assigned to the project, in which case i could return 100 Starbucks Coffee. but lets say i just want to display al...

writeback to SQL 2005
hello! I use excel 2007 iI open a connection agianst SQL server 2005 and choose a table. In my workbook i can now see this data from this table. if i change a value in some cell i wish to writeback to table in SQL server. Is this possible? It's possible through the use of VBA and ADO, but not simply using the data connection you've already established. Ross "CJ" <CJ@discussions.microsoft.com> wrote in message news:D54EC521-0DD5-4B3D-971B-4FF3394D6FA8@microsoft.com... > hello! I use excel 2007 > iI open a connection agianst SQL server 2005 and choose a table...

sql.request #2
Does anyone have a comprehensible guide on how to use it that a dolt like me can follow? Every time I try I get a #N/A. The only guide I can find is at http://www.bygsoftware.com/examples/zipfiles/UsingSqlRequest.zip but it's really hard to follow. From the MSDN Library: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/SEC41.asp Not sure how familiar you are with ODBC; but if you are getting #N/A as a result, it is usually because of problems either with the SQL syntax or the connection string. There are a few examples of connection strings in the re...

How to: selected messages create "new message alert"?
Hi, using Outlook 2002 I would like some mails to be automatically moved to a specific mailbox and NOT create a new message alert (sound, letter icon in taskbar). This might be for example postlists I'm subscribed to since there are sometimes minutes between messages... Is this possible? VB scripting maybe? thanx David Uncheck the universal new mail sound and set it individually on your mails via rules wizard. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my person...

MSDE or SQL Personal or SQL Developer? or SQL Workstation?
Hi, which one is better for personal non-server computer? MSDE? SQL Personal? SQL Developer? SQL Workstation? Thank you. It depends on what edition of GP you are going to run. If you are going to use Professional, you need to go with SQL Server developer, assuming you are installing on a non-server OS. "ano" wrote: > Hi, which one is better for personal non-server computer? MSDE? SQL Personal? > SQL Developer? SQL Workstation? > Thank you. Is the function of SQL Developer the same as Enterprise edition? How about personal edition? Can it be used for GP Pro? Can dev...