Re: Need help with Code Please!!!



Lisa,

Can you copy your current code and paste it into the thread again?

Also, post the error number, the text of the error message, the line that is
highlighted when the error occurs.

Lastly, post the text of the SQL string after the complete build. You can
do this by adding a Debug.Print SQ1 line immediately after the last line that
builds SQ1.

Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Lisa" wrote:

I made a typo yeaterday. The error highlights
qd.SQL = sQ1
I don't really know if that makes a difference. I have tried and corrected
some of you comments and am still have the same error message.
--
Lisa S.


"Dale Fye" wrote:

I was going to say that given that her first query that defines her recordset
only selects Company and USFSItemNo, that I think DISTINCT is what she
probably needed.

Then I copied the SQ1 code and pasted it into Word, and found that she never
references either of those recordsets fields in the query that she is
building inside the loop, so I don't know what she is doing. The only reason
I can think of for building the other query inside of the loop is to
reference the values in the recordset that is being looped through.

Additionally:
1. She has numerous lines where she needs to insert a space before the
"AND" or "WHERE" so that the spacing will be correct.

2. She has referenced the controls for txtBeginningDate and txtEndingDate
inside of the quotes in here WHERE clause, so that won't work. Should
probably look like:

SQ1 = SQ1 & " WHERE tblInvoiceHistAll.[Ship Date] BETWEEN #" _
& Forms![frmReportRebateParameters]!txtBeginningDate & "# AND #"
& Forms![frmReportRebateParameters]! & "# "

3. She also refers to a value 'e-mail' in her WHERE clause that is not a
declared variable, so it probably needs to be wrapped in quotes, like:

SQ1 = SQ1 & " AND tblItemListVendor.BillBackDelivMethod = 'e-mail'))"

Lisa, I hope some of these comments will help.

Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Stuart McCall" wrote:

"Dale Fye" <dale.fye@xxxxxxxxxx> wrote in message
news:9A40E978-A83D-426C-9CFB-C1C11B3582E8@xxxxxxxxxxxxxxxx
I would also recommend that you replace your DISTINCTROW with DISTINCT.

DISTINCTROW looks at all of the fields in the joined table, so it takes
longer than DISTINCT, which only looks at the fields in the query.
<SNIP>

But DISTINCT returns unique values, unlike DISTINCTROW.




.



Relevant Pages

  • Re: DIR function in Access 2000
    ... It would be worth checking your references are okay. ... Press Ctrl+G to open the Immediate window. ... This has an autoexec macro including a query which uses a DIR function to ... Error message is User-defined type not defined. ...
    (microsoft.public.access.formscoding)
  • Re: Reserved error (-1524); there is no message for this error.
    ... I even have a query where this type of WHERE clause works ... I get this same weird error message. ... Check your references to see if any show as "Missing" ...
    (comp.databases.ms-access)
  • Re: Need help with Code Please!!!
    ... The error highlights ... Then I copied the SQ1 code and pasted it into Word, ... references either of those recordsets fields in the query that she is ... I can think of for building the other query inside of the loop is to ...
    (microsoft.public.access.formscoding)
  • Re: OutputTo to Excel question
    ... I can't help you with the macro error message as I don't use macros. ... the result from a query. ... Save a query that pulls the same data as the report. ...
    (microsoft.public.access.macros)
  • Re: Background Web Queries flaws!
    ... There is no way to trap errors on a background query. ... There is no way to control the timeout setting. ... The basic problem is that IE spits an error message before returning control ... > hard coded a 5 minute limit into the web query system. ...
    (microsoft.public.excel.programming)

Loading