the followings ar my code:
Private Sub 訂_Click()
Dim IntUnit As Integer
  Dim AmtUnit As Integer

Dim theConnection As New ADODB.Connection
  Dim strSQL As String

IntUnit = txtUnit
  IntAmt = txtAmt

strSQL = "INSERT INTO OrderTable"
  strSQL = strSQL & "(Unit, Amt)"
  strSQL = strSQL & "VALUES("
  strSQL = strSQL & "&IntUnit&"
  strSQL = strSQL & "&IntAmt&"

   With theConnection
  .Open "DSN=OrderDSN"
  .Execute strSQL
  .Close
  End With
  Set theConnection = Nothing
  strSQL = ""
  
End Sub
After press F5 and enter number into IntUnit and IntAmt, it comes out run-time error '-214727900(80040e14)'. [Microsoft][ODBC Microsoft Access 97 Driver] syntax error (missing operator) in query expression '&IntUnit&&IntAmt&'
Does anyone can explain to me and how can i solve that problem.
Thanks in deep if anyone would help me, thx thx
arrow
arrow
    全站熱搜

    vbqa 發表在 痞客邦 留言(1) 人氣()