Re: SQL not working
- From: "Alex Dybenko" <alexdyb@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Oct 2006 19:58:19 +0400
Hi,
try:
MergeStatusUpdate = MergeStatusUpdate + rst![Status Date] + " " + "00" + " "
--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Paul Dennis" <PaulDennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:54C3D3E4-838E-44A3-AAAC-2577DAEA07DF@xxxxxxxxxxxxxxxx
Can you help with this one which is a follow up?
The module won't compile caused by the MergeStatusUpdate = statement. It is
having problems understanding [Status Date] which is a field on my table
returned from thr SQL statement. If I add a watch statement to [Status Date]
it says "Expresssion not defined in context".
Do While rst!Reference = E_Reference
MergeStatusUpdate = MergeStatusUpdate + [Status Date] + " " + "00" + " "
rst.FindNext strReference
"Alex Dybenko" wrote:
Hi,
looks like too many brackets here:
HAVING ((([SIP Reference]) = " & E_Reference & ") " & _
just remove all of then and try again
HAVING [SIP Reference] = " & E_Reference & " " & _
--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Paul Dennis" <PaulDennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1B960FF3-9567-43C7-9009-ECF1C43F45A6@xxxxxxxxxxxxxxxx
>I have an SQL statement in a Macro which looks to have the correct >syntax
> however doesn't return anything.
>
> It always hits the NoMatch and goes to LoopExit
>
> Any ideas
>
> Code below:
>
> Function MergeStatusUpdates(E_Reference As String, E_RestructedFlag As
> String) As String
> .
> .
> MergeStatusUpdate = ""
> Set DB = CurrentDb
>
> strSQL = "SELECT [SIP Reference],[Status Date],[Status > Comments],[Customer
> Restricted] " & _
> "FROM [SIP Status] " & _
> "GROUP BY [SIP Reference],[Status Date],[Status
> Comments],[Customer
> Restricted] " & _
> "HAVING ((([SIP Reference]) = " & E_Reference & ") " & _
> "ORDER BY [Status Date] Desc;"
>
> Set rst = CurrentDb.OpenRecordset(strSQL)
> strReference = "[SIP Reference] = " & E_Reference & ""
>
> rst.FindFirst strReference
> If rst.NoMatch Then GoTo Loop_Exit
>
> Do While rst!Reference = E_Reference
> MergeStatusUpdate = MergeStatusUpdate + "00" + " " + "00" + " "
> rst.FindNext strReference
>
> If rst.NoMatch Then GoTo Loop_Exit
>
> Loop
> ---------------------------------------------
> I have watched the code and strReference = "SELECT [SIP > Reference],[Status
> Date],[Status Comments],[Customer Restricted] FROM [SIP Status] GROUP > BY
> [SIP
> Reference],[Status Date],[Status Comments],[Customer Restricted] HAVING
> ((([SIP Reference]) = 29) ORDER BY [Status Date] Desc;"
.
- References:
- Re: SQL not working
- From: Alex Dybenko
- Re: SQL not working
- From: Paul Dennis
- Re: SQL not working
- Prev by Date: Re: Control char that will force CR in Excel when exported.
- Next by Date: Re: Parameter query returns empty recordset
- Previous by thread: Re: SQL not working
- Next by thread: Re: SQL not working
- Index(es):
Relevant Pages
|