pop-up form to filter report

From: Leasha (anonymous_at_discussions.microsoft.com)
Date: 04/28/04


Date: Tue, 27 Apr 2004 17:23:34 -0700

First try this, when writing sql code use double quotes to
denote the sql query text and single quotes for string
variables. John is right about the need to lose the
quotes around numeric variables. Another problem may be
the question mark in the field name ([Tagged?]). Symbols
are not recommended for use in field names as they are
often reserved. Put them in the label text on the form or
report only. In the case of the question mark it is a wild
card for a single character. So, having covered all that
the sql code should look something like:

"([Tagged?] =-1)"
"([VendorName] = 'XXXX')" or
"([VendorName] = " & 'XXXX' & ")"

with spaces whereever necessary to fulfill the
requirements of the syntax.

Good luck.

>-----Original Message-----
>Hi - Have downloaded the sample database "RptSmp97.mdb".
>It includes a nifty sample "Setting Filter/Filter On
>from a pop-up form"
>1) I've copied this with partial success.
>2) I know basically nothing about SQL.
>3) The fields I want to select by are combo boxes.
>
>Had posted this on 4/21 under the Forms group and got a
>good answer from John Vinson, but he was unable to reply
>to my latest post.
>
>The report source query is:
>SELECT DISTINCTROW Products.ProductName,
>Suppliers.SupplierCode, Products.VendorPart,
>Categories.CategoryName, Products.UnitPrice,
>Products.SellPrice, Products.[Tagged?]
>FROM Suppliers INNER JOIN (Categories RIGHT JOIN Products
>ON Categories.CategoryID = Products.CategoryID) ON
>Suppliers.SupplierID = Products.SupplierID
>ORDER BY Products.ProductName;
>
>I want to be able to filter by "supplier" and/or
>"category" and/or "tagged?" but because(?) they are combo
>boxes, I get the error message
>
>Syntax error (missing operator) in query
>expression '([Tagged?] ="-1" A)'.
>
>or some variation of it.
>JOhn's reply was "Lose the quote marks. They work when the
>field is a String but are prohibited when the field is
>numeric." I"ve been trying, but wonder which quote marks?
>I'm now getting the same message no matter which filter
>I try to use. "Tagged?" is a yes/no field, so Access
>considers it 0,-1. I eliminated that option, and I get
>Syntax error (missing operator) in query
>expression '([VendorName] ="XXXX" A)'. Is this because
the
>vendor name combobox shows my alpha vendor ID, it is
still
>askingfor numeric data, i.e. vendor ID autonumber?
>
>Can anybody out there please help? Thanks in advance.
>
>Regards, Lisa
>
>.
>



Relevant Pages

  • pop-up form to filter report
    ... I meant to remove the question mark: ... when writing sql code use double quotes ... >denote the sql query text and single quotes for string ...
    (microsoft.public.access.reports)
  • Re: Update Query Error 2007 Correction
    ... John, I apologize, it did not change, I re-opened another query by mistake. ... The other SQL statement I have corrected and is giving me this error. ... THIS IS THE SQL CODE WHEN I RE-OPENED THE QUERY TO RE-EXAMINE IT. ...
    (microsoft.public.access.reports)
  • Re: how to link to a csv file with a date field in it?
    ... Regarding the scheduler it's in XP and above - if you aren't familiar with using the Windows Task Scheduler, here is a link to a fairly clean, simple, short tutorial. ... I think you have the right idea - link to the csv, maybe run an append query to process the contents into your main table, in that query you can fix things such as the date. ... s is the complete row of data as a string, flag is a boolean that is initialized to be False. ... The full code I snipped this from contains so much checking for quotes and # hashes and internal commas and internal single quotes replacing certain chars, that it's difficult for me to follow and I wrote it. ...
    (microsoft.public.access.externaldata)
  • Re: how to link to a csv file with a date field in it?
    ... I think you have the right idea - link to the csv, maybe run an append query to process the contents into your main table, in that query you can fix things such as the date. ... s is the complete row of data as a string, flag is a boolean that is initialized to be False. ... We can create a recordset object and set it to a specific table - we add the new row one field at a time, testing each field for type using a select case, add the # for dates or ' for text or nothing for numeric field types to the fldArrrayelement contents and the set rs.fields= the resulting expression. ... The full code I snipped this from contains so much checking for quotes and # hashes and internal commas and internal single quotes replacing certain chars, that it's difficult for me to follow and I wrote it. ...
    (microsoft.public.access.externaldata)
  • Aging Function
    ... I took your advice and the query worked! ... total debits for those accounts, ... >problem with using the accounts as criteria. ... >it was a result of the missing single quotes. ...
    (microsoft.public.access.modulesdaovba)