Home > Software engineering >  Vb a select query error 40 points where multiple conditions
Vb a select query error 40 points where multiple conditions

Time:10-09

Private Sub Command14_Click ()
Dialog. The Show
Form3. Hide
Adodc2. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0;" & "Data Source=" + App. Path + "\ starter db1. MDB;"
Adodc2.Com mandType=adCmdText
Adodc2. RecordSource="Select * from national standard car battery parameter table where the single battery number=" & amp; XDCDGS & amp; "And rated voltage (V)=" & amp; Xdceddy & amp; "And starting current (A) & gt;="& amp; XDCQDDL & amp; "And dry lotus type battery='" & amp; XDCGHX & amp; "' And avoid WeiHuXing battery=" & amp; XDCMWH & amp; "' And good low-temperature startup performance=" & amp; XDCDWH & amp; "' And high resistant=" & amp; XDCGKZ & amp; "' And low temperature anti outfit=" & amp; XDCDFZ & amp; "' And rated capacity (Ah) & gt;="+ Text31. Text +"
"Adodc2. Refresh
End Sub

Why always appear the following error message, PLS help to have a look at
Syntax error loss (operator) in the query the single battery number="& amp; XDCDGS & amp; "And rated voltage (V)=" & amp; Xdceddy & amp; "And starting current (A) & gt;="& amp; XDCQDDL & amp; "And dry lotus type battery='" & amp; XDCGHX & amp; "' And avoid WeiHuXing battery=" & amp; XDCMWH & amp; "' And good low-temperature startup performance=" & amp; XDCDWH & amp; "' And high resistant=" & amp; XDCGKZ & amp; "' And low temperature anti outfit=" & amp; XDCDFZ & amp; "' And rated capacity (Ah) & gt;="+ Text31. Text +" "

CodePudding user response:

And have a space before And after,

CodePudding user response:

Not only logical operators and the space before and after, and the fields of the characters should be in quotes,

CodePudding user response:

Is the lack of space,

Adodc2. RecordSource="Select * from national standard car battery parameter table where the single battery number=" & amp; XDCDGS & amp; "And rated voltage (V)=" & amp; Xdceddy & amp; "And starting current (A) & gt;="& amp; XDCQDDL & amp; "And dry lotus type battery='" & amp; XDCGHX & amp; "' And avoid WeiHuXing battery=" & amp; XDCMWH & amp; "' And good low-temperature startup performance=" & amp; XDCDWH & amp; "' And high resistant=" & amp; XDCGKZ & amp; "' And low temperature anti outfit=" & amp; XDCDFZ & amp; "' And rated capacity (Ah) & gt;="& amp; Text31. Text
  •  Tags:  
  • VBA
  • Related