something went wrong with sqlString

smig

Registered User.
Local time
Today, 03:39
Joined
Nov 25, 2009
Messages
2,209
I'm using this code
but getting error 3163 - The field is too small to accept the amount of data...
I get the error on the last line here.

If I copy the strSQL text into the query builder and use the saved query all is well :confused:

Any idea ?

Code:
Dim strQRY As String
Dim strWhereClues As String
Dim CountReturnChecksToPay As Integer

strQRY = "SELECT [Lekochot_Kabalot].[KabalaID], Sum([SumTashlumimForKabala]) AS [SumTashlumimForKabala], Sum([Lekochot_KabalotReturn_Kabalot].[UsedForKabala]) AS [SumUsedForKabala] " & _
    " FROM (([Lekochot_Kabalot] LEFT JOIN [Lekochot_KabalotReturn_Kabalot] ON [Lekochot_Kabalot].[KabalaID] = [Lekochot_KabalotReturn_Kabalot].[KabalaReturnID]) " & _
    " LEFT JOIN [Lekochot_Kabalot] AS [Lekochot_Kabalot_1] ON [Lekochot_KabalotReturn_Kabalot].[KabalaID] = [Lekochot_Kabalot_1].[KabalaID]) INNER JOIN [qry_SumTashlumimForKabala] ON [Lekochot_Kabalot].[KabalaID] = [qry_SumTashlumimForKabala].[KabalaID] " & _
    " WHERE [Lekochot_Kabalot].[SugKabala] = 4 And [Lekochot_Kabalot].[KabalaCancelDate] Is Null And [Lekochot_Kabalot_1].[KabalaCancelDate] Is Null And [Lekochot_Kabalot].[LakoachID] = GetLakoachID() " & _
    " GROUP BY [Lekochot_Kabalot].[KabalaID] "

strWhereClues = "[SumTashlumimForKabala] <> [SumUsedForKabala] "
CountReturnChecksToPay = DCount("*", strQRY, strWhereClues)

Thank you,
Tal
 
Try declare CountReturnChecksToPay as Long instead of Integer.
Code:
Dim CountReturnChecksToPay As Long
 

Users who are viewing this thread

Back
Top Bottom