Home > Software engineering >  For help, you great god help have a look
For help, you great god help have a look

Time:09-17

You look great god, good strange, I operated by VBA is essentially database did not change, other two statements in SQL is able to find out, but in VBA, one normal, one error

An error
The Public Function Create_Report101 ()
Dim strSql01 As String, strSql02 As String, As SQL String, strSql03 As String, strSql04 As String, strSql05 As String, strSql06 As String, strSql07 As String, strSql08 As String, strSql09 As String, strSq201 As String

Set the cn=CreateObject (" adodb. Connection ")
Set the rs=CreateObject (" adodb. You ")


Workbooks (" international capital volume for 120 days. XLSX "). The Activate
Worksheets (" main screen "). Activate
StartDate=Range (" i2 "). The Value
EndDate=Range (" second "). The Value

StrSql01="INSERT INTO t_66666_registers" & amp; VbNewLine & amp; _
"SELECT 'total equity, the SUM (t_flex_cusfund. [the final rights])/10000000"

StrSql02="FROM t_flex_cusfund" & amp; VbNewLine & amp; _
"WHERE t_flex_cusfund. [trading]='20200915'" & amp; VbNewLine & amp; _
"Select * from t_66666_registers
"
'strSql01="SELECT the' total ', the SUM (t_flex_cusfund. [the final rights])/10000000"

'strSql02="FROM t_flex_cusfund" & amp; VbNewLine & amp; _
"WHERE t_flex_cusfund. [trading]='20200916'"

SQL=strSql01 & amp; StrSql02
Cn. Open ServerConn
Cn.Com mandTimeout=600
Rs. The Open SQL, cn


Workbooks (" international capital volume for 120 days. XLSX "). The Activate
Worksheets (" daily "). Activate
Range (A: "aa"). The Clear

Range (" a1 "). CopyFromRecordset rs

Error: vba runtime error 3704 object is closed, not allowed to operate
Normal
The Public Function Create_Report101 ()
Dim strSql01 As String, strSql02 As String, As SQL String, strSql03 As String, strSql04 As String, strSql05 As String, strSql06 As String, strSql07 As String, strSql08 As String, strSql09 As String, strSq201 As String

Set the cn=CreateObject (" adodb. Connection ")
Set the rs=CreateObject (" adodb. You ")


Workbooks (" international capital volume for 120 days. XLSX "). The Activate
Worksheets (" main screen "). Activate
StartDate=Range (" i2 "). The Value
EndDate=Range (" second "). The Value

'strSql01="INSERT INTO t_66666_registers" & amp; VbNewLine & amp; _
"SELECT 'total equity, the SUM (t_flex_cusfund. [the final rights])/10000000"

'strSql02="FROM t_flex_cusfund" & amp; VbNewLine & amp; _
"WHERE t_flex_cusfund. [trading]='20200915'" & amp; VbNewLine & amp; _
"Select * from t_66666_registers
"
StrSql01="SELECT the 'total', the SUM (t_flex_cusfund. [the final rights])/10000000"

StrSql02="FROM t_flex_cusfund" & amp; VbNewLine & amp; _
"WHERE t_flex_cusfund. [trading]='20200916'"

SQL=strSql01 & amp; StrSql02
Cn. Open ServerConn
Cn.Com mandTimeout=600
Rs. The Open SQL, cn


Workbooks (" international capital volume for 120 days. XLSX "). The Activate
Worksheets (" daily "). Activate
Range (A: "aa"). The Clear

Range (" a1 "). CopyFromRecordset rs
  •  Tags:  
  • VBA
  • Related