S
Simon
I have the below code, it does not bring up any error message but just
does not add the data to the table
Any ideas???
This is running from a subform and the OrderNumber needs to come from
the main form
Private Sub Command22_Click()
Dim cmd As ADODB.Command
Dim strSQL As String
Dim strQty As String
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdText
strQty = InputBox("How many to buy:", "Purchase Product")
If Len(strQty) > 0 Then
' confirm that valid number entered
If IsNumeric(strQty) Then
If IsNumeric(strQty) Then
strSQL = "INSERT INTO tblOrderProduct (ProductID,
OrderNumber, Qty) VALUES (Me.ProductID, 900, strQty)"
cmd.CommandText = strSQL
Else
MsgBox "Invalid quantity entered.", vbExclamation,
"Warning"
End If
Else
' user pressed Cancel button or entered no quantity in input
box
MsgBox "Purchase Cancelled.", vbInformation, "Purchase
Product"
cmd.Execute
End If
End If
End Sub
does not add the data to the table
Any ideas???
This is running from a subform and the OrderNumber needs to come from
the main form
Private Sub Command22_Click()
Dim cmd As ADODB.Command
Dim strSQL As String
Dim strQty As String
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdText
strQty = InputBox("How many to buy:", "Purchase Product")
If Len(strQty) > 0 Then
' confirm that valid number entered
If IsNumeric(strQty) Then
If IsNumeric(strQty) Then
strSQL = "INSERT INTO tblOrderProduct (ProductID,
OrderNumber, Qty) VALUES (Me.ProductID, 900, strQty)"
cmd.CommandText = strSQL
Else
MsgBox "Invalid quantity entered.", vbExclamation,
"Warning"
End If
Else
' user pressed Cancel button or entered no quantity in input
box
MsgBox "Purchase Cancelled.", vbInformation, "Purchase
Product"
cmd.Execute
End If
End If
End Sub