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
[解决办法]
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