Home > database >  Novice access, multiple SQL execution
Novice access, multiple SQL execution

Time:10-12

Perform multiple SQL,
Private Sub Command1_Click ()
Dim strSql as string
StrSQL="XXXXX"
DoCmd. RunSql strSQL 'running the first update statement
StrSQL="XXXX"
DoCmd. RunSql strSQL 'run a second update statement
End Sub

SQL is a line is very easy to perform, copied directly replace XXXX is ok, but now there are more lines in the SQL,
1, such as: select a. a. 2 sum a. 3 as 4 into b in 'F: \ YYYYYYYYY'
From a
1, group by a. a., 2 a, 3
Having (a. 1="W");

Advice on how to perform, pure white, really do not understand,

CodePudding user response:

Remove the SQL statements in a line, line, or use + the multi-line SQL statements such as link

CodePudding user response:

Get a form, put a text box, and put the SQL, execute SQL will take the content of the text box

CodePudding user response:

Private Sub Command1_Click ()
Dim strSql as string
StrSQL="1, select a. a. 2 sum a. 3 as 4 into b 'F: \ YYYYYYYYY + in the from a + group by a. 1, a., 2 a, 3 + having (a. 1=" W ");"
DoCmd. RunSql strSQL 'running the first update statement
StrSQL="XXXX"
DoCmd. RunSql strSQL 'run a second update statement
End Sub

Is that right errors increase + tried away line breaks into Spaces are not
Study hard a great god, and help

CodePudding user response:

StrSQL="1, select a. a. 2 sum a. into 3 as 4 b in 'F: \ YYYYYYYYY'"
+ "from a"
1, + "group by a. a., 2 a, 3 + having (a. 1=" W ");" Like this?
  • Related