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
when i press F5, it said runtime error '13'. type mismatch on (Dim IntUnit As Integer). So what is my problem? is anyone can help me?

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