Re: Need help with query linked to form.



Here is the SQL.

PARAMETERS [Forms]![Open Po - f]![Query date] DateTime;
SELECT [PO data-t].[HDSTH#], [PO data-t].[HDPO#], [PO data-t].HDVID, [PO
data-t].VXDNAM, [PO data-t].HDODAT, [PO data-t].HDDDAT, [PO data-t].HDBUYR,
[PO data-t].[LNLN#], [PO data-t].LNITEM, [PO data-t].LNDESC, [PO
data-t].LNVCAT, [PO data-t].[LNGL#], [PO data-t].LNLCID, [PO data-t].LNOQTY,
[PO data-t].LNRQTY, [PO data-t].LNUNIT, [PO data-t].LNUPRC, [PO
data-t].LNXLNT, [PO data-t].LNDDAT, [PO data-t].LNTYPE, [PO data-t].HDRSTS,
[PO data-t].LNRSTS
FROM [PO data-t]
WHERE ((([PO data-t].HDODAT)=[Forms]![Open Po - f]![Query date]));


"Allen Browne" wrote:

Yes: post the SQL please.

That message just means Access can't parse the SQL statement. It can be 'too
complex' (e.g. too many ANDs or UNIONs), but it can also be other things
like bad data types, or reserved words used as field names.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:039F5900-BCFF-4DC8-93B1-D6899861163C@xxxxxxxxxxxxxxxx
Allen thank you for that info. I think it is what I needed but I am now
getting an error stating that "This expression is typed incorrectly, or it
is
too complex to be evaluated. For example, a numeric expression may contain
too many compliated elements. Try simplifying the expression by assigning
parts of the expression to variables." I am not sure what this means. Let
me
know if the SQl would help. Thanks

"Allen Browne" wrote:

So your query contains something like:
[Forms].[Form1].[Text0]

To ensure JET understands this correctly:

a) Declare the parameter in the query.
In query design, choose Parameters on the Query Design tab of the ribbon
(Show/Hide chunk.) Access pops up a dialolg. Enter:
[Forms].[Form1].[Text0] Date/Time

b) Set the Format property of the text box on the form.
Use a date format, such as Short Date or yyyy\-mm\-dd.
This is how you indicate the data type of an unbound text box.
You should now find that Access rejects 2008-02-31 as a bad entry.

c) Make sure you move out of Text0 before running the query.
Access doesn't update the Value of a text box until you move the focus to
some other control.

"Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:38C76EBF-4EB9-4FC1-A470-92E60423D47C@xxxxxxxxxxxxxxxx
Hi, I am trying to run a query based off of an unbound field in a form.
Essentially I would like the end user to input a date in the form and
hit
the
command button to run the query where the date would cross over to the
query
criteria. I have done this in access 2000 but since upgrading to 2007
it
doesn't seem to be working. I have my date feild formated as yyyy-mm-dd
in
both my table and my form so they should match? Any help on this would
be
much appreciated. Thanks


.


Quantcast