ktt2
asked on
[Microsoft][ODBC SQL Server Driver]String data, right truncation (#0)
HMMM...weird thing happened....now after converting that field to a smalldatetime...when I open the search form I get this error:
[Microsoft][ODBC SQL Server Driver]String data, right truncation (#0)
I've run a SQL statement in Query Analyzer and it works fine, but on the form i get this error message...
What other details may you need to help?
here's the code:
strSQL = " SELECT * FROM dbo_vfullCC WHERE"
' If the Full CC # is checked then search complete Account Number
If Me.CCcheckBox.Value = 1 Then
strSQL = strSQL & " [Accountnumber] = '" & txtFullCCNbr & "'"
If (IsNull(Me.txtFullCCNbr)) Then
MsgBox "Please Enter an Account Number For Your Search"
End If
If (Not IsNull(Me.txtAmount)) Then
strSQL = strSQL & " AND [Amount] = " & Me.txtAmount.Value & ""
End If
If (Not IsNull(Me.txtFromDate.Valu e)) And (Not IsNull(Me.txtToDate.Value) ) Then
strSQL = strSQL & " AND [Transactiondate] Between '" & Me.txtFromDate.Value & "' and '" & Me.txtToDate.Value & "'"
strSQL = strSQL & " ORDER by [Transactiondate]"
ElseIf (IsNull(Me.txtFromDate.Val ue)) And (Not IsNull(Me.txtToDate.Value) ) Then
strSQL = strSQL & " AND ([Transactiondate] <= '" & Me.txtToDate.Value & "')"
ElseIf (Not IsNull(Me.txtFromDate.Valu e)) And (IsNull(Me.txtToDate.Value )) Then
strSQL = strSQL & " AND ([Transactiondate] >= '" & Me.txtFromDate & "')"
ElseIf (IsNull(Me.txtFromDate.Val ue)) And (IsNull(Me.txtToDate.Value )) Then
End If
Else
'Check for Partial Account Number
strSQL = strSQL & " [Lastfour] = '" & Me.txtPartialCCNbr.Value & "'"
If (IsNull(Me.txtPartialCCNbr )) Then
MsgBox "Please Enter the Last Four Digits of Account Number for Your Search"
End If
If (Not IsNull(Me.txtAmount)) Then
strSQL = strSQL & " AND [Amount] = " & Me.txtAmount.Value & ""
End If
If (Not IsNull(Me.txtFromDate.Valu e)) And (Not IsNull(Me.txtToDate.Value) ) Then
strSQL = strSQL & " AND [Transactiondate] Between '" & Me.txtFromDate.Value & "' and '" & Me.txtToDate.Value & "'"
strSQL = strSQL & " ORDER by [Transactiondate]"
ElseIf (IsNull(Me.txtFromDate.Val ue)) And (Not IsNull(Me.txtToDate.Value) ) Then
strSQL = strSQL & " AND ([Transactiondate] <= '" & Me.txtToDate.Value & "')"
ElseIf (Not IsNull(Me.txtFromDate.Valu e)) And (IsNull(Me.txtToDate.Value )) Then
strSQL = strSQL & " AND ([Transactiondate] >= '" & Me.txtFromDate & "')"
ElseIf (IsNull(Me.txtFromDate.Val ue)) And (IsNull(Me.txtToDate.Value )) Then
End If
End If
MsgBox strSQL
Me.lstFullCC.RowSource = strSQL
'Sets Dbs to be the currently open Db
Set db = CurrentDb
'Modifies the query from the SQL, "qryCCSearchResults" is the queryname
Set qdf = db.QueryDefs("qryCCSearchR esults")
qdf.SQL = strSQL
qdf.Close
End Sub
[Microsoft][ODBC SQL Server Driver]String data, right truncation (#0)
I've run a SQL statement in Query Analyzer and it works fine, but on the form i get this error message...
What other details may you need to help?
here's the code:
strSQL = " SELECT * FROM dbo_vfullCC WHERE"
' If the Full CC # is checked then search complete Account Number
If Me.CCcheckBox.Value = 1 Then
strSQL = strSQL & " [Accountnumber] = '" & txtFullCCNbr & "'"
If (IsNull(Me.txtFullCCNbr)) Then
MsgBox "Please Enter an Account Number For Your Search"
End If
If (Not IsNull(Me.txtAmount)) Then
strSQL = strSQL & " AND [Amount] = " & Me.txtAmount.Value & ""
End If
If (Not IsNull(Me.txtFromDate.Valu
strSQL = strSQL & " AND [Transactiondate] Between '" & Me.txtFromDate.Value & "' and '" & Me.txtToDate.Value & "'"
strSQL = strSQL & " ORDER by [Transactiondate]"
ElseIf (IsNull(Me.txtFromDate.Val
strSQL = strSQL & " AND ([Transactiondate] <= '" & Me.txtToDate.Value & "')"
ElseIf (Not IsNull(Me.txtFromDate.Valu
strSQL = strSQL & " AND ([Transactiondate] >= '" & Me.txtFromDate & "')"
ElseIf (IsNull(Me.txtFromDate.Val
End If
Else
'Check for Partial Account Number
strSQL = strSQL & " [Lastfour] = '" & Me.txtPartialCCNbr.Value & "'"
If (IsNull(Me.txtPartialCCNbr
MsgBox "Please Enter the Last Four Digits of Account Number for Your Search"
End If
If (Not IsNull(Me.txtAmount)) Then
strSQL = strSQL & " AND [Amount] = " & Me.txtAmount.Value & ""
End If
If (Not IsNull(Me.txtFromDate.Valu
strSQL = strSQL & " AND [Transactiondate] Between '" & Me.txtFromDate.Value & "' and '" & Me.txtToDate.Value & "'"
strSQL = strSQL & " ORDER by [Transactiondate]"
ElseIf (IsNull(Me.txtFromDate.Val
strSQL = strSQL & " AND ([Transactiondate] <= '" & Me.txtToDate.Value & "')"
ElseIf (Not IsNull(Me.txtFromDate.Valu
strSQL = strSQL & " AND ([Transactiondate] >= '" & Me.txtFromDate & "')"
ElseIf (IsNull(Me.txtFromDate.Val
End If
End If
MsgBox strSQL
Me.lstFullCC.RowSource = strSQL
'Sets Dbs to be the currently open Db
Set db = CurrentDb
'Modifies the query from the SQL, "qryCCSearchResults" is the queryname
Set qdf = db.QueryDefs("qryCCSearchR
qdf.SQL = strSQL
qdf.Close
End Sub
ASKER
In the Access Front END I cannot get past this error message for me to even search...
QA example working:
select amount, [account nbr], date
from vfullCC
where amount = 205.64 and date between '03/17/99' and '03/10/00' and [Lastfour]='2004'
Order by date
QA example working:
select amount, [account nbr], date
from vfullCC
where amount = 205.64 and date between '03/17/99' and '03/10/00' and [Lastfour]='2004'
Order by date
ASKER
This was all working before I decided to convert the Transactiondate field from nvarchar(15) to a smalldatefield data type.
ASKER
Answered my own question...I dropped that view since it was created before the change and created it again. now it is working fine!
Mod please delete
Mod please delete
>>Mod please delete <<
The way it works here is as follows:
I answered my question myself. What do I do?
https://www.experts-exchange.com/help/closing.jsp#4
And while you are at it, please maintain your other old open questions:
1 10/12/2003 250 Making a W2k Pro Bootable CD with third ... Open Windows 2000
2 10/22/2003 125 Help with Design on a YES/NO Questionnai... Open Microsoft Access
3 09/17/2003 250 Dell Poweredge 1300 Server not booting u... Open Hardware
Thanks,
Anthony
The way it works here is as follows:
I answered my question myself. What do I do?
https://www.experts-exchange.com/help/closing.jsp#4
And while you are at it, please maintain your other old open questions:
1 10/12/2003 250 Making a W2k Pro Bootable CD with third ... Open Windows 2000
2 10/22/2003 125 Help with Design on a YES/NO Questionnai... Open Microsoft Access
3 09/17/2003 250 Dell Poweredge 1300 Server not booting u... Open Hardware
Thanks,
Anthony
ASKER
Ok so it says Ask For it...Can you close all three please??
Thank you,
Kevin
Thank you,
Kevin
I am not a Moderator. Besides I think you are quoting out of context, it actually says:
"Post a question in the Community Support topic area asking for a refund, and asking the Moderators to close the question."
The link to Community Support is at https://www.experts-exchange.com/Community_Support/
Thanks,
Anthony
"Post a question in the Community Support topic area asking for a refund, and asking the Moderators to close the question."
The link to Community Support is at https://www.experts-exchange.com/Community_Support/
Thanks,
Anthony
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and the sql generated by the above which is supposed to be the same as your working version...