读书人

VBA字符串赋值超过255字符怎么办

发布时间: 2013-08-01 15:23:18 作者: rapoo

VBA字符串赋值超过255字符怎么处理?
Sql_text = "Select fitemid,fnumber,fname,flowlimit,fhighlimit,fqty,sum(fsellqty) as fsellqty From V_XMK_V_XMK_SecInv_sell_Qty Where 1=1 "
If startdate <> " " Then
Sql_text = Sql_text & " And FDate>=" & " '" & startdate & " '"
End If
If enddate <> " " Then
Sql_text = Sql_text & " And FDate<=" & " '" & enddate & " '"
End If

Sql_text = Sql_text + " group by fitemid,fnumber,fname,flowlimit,fhighlimit,fqty Order by fnumber "

Sql_text = Sql_text + " union select *,0 As fsellqty from V_XMK_SecInvQty where fitemid not in (select fitemid"
Sql_text = Sql_text + " from V_XMK_V_XMK_SecInv_sell_Qty where 1=1 "
If startdate <> " " Then
Sql_text = Sql_text & " And FDate>=" & " '" & startdate & " '"
End If
If enddate <> " " Then
Sql_text = Sql_text & " And FDate<=" & " '" & enddate & " ')"
End If

监视Sql_text的值,只能到"Select fitemid,fnumber,fname,flowlimit,fhighlimit,fqty,sum(fsellqty) as fsellqty From V_XMK__SecInv_sell_Qty Where 1=1 And FDate>= '2013-01 ' And FDate<= '2013-06 ' group by fitemid,fnumber,fname,flowlimit,fhighlimit,fqty Order by fnumber union s


[解决办法]

引用:
你在VBA里试一下,能赋值超过255个字符吗?

没看清楚是VBA,刚刚打开excel试了一下
Private Sub CommandButton1_Click() 


Dim s As String
Dim t As String, p As String
t = "[" & String(200, "t") & "]" & vbCrLf
p = "[" & String(300, "p") & "]" & vbCrLf
s = t & p
MsgBox s & vbCrLf & " len=" & Len(s)
End Sub

VBA字符串赋值超过255字符怎么办

读书人网 >VB

热点推荐