G
Guest
Hi,
I faced another problem which I can't solve on my own.
I got a table and a form. I want to use the form to append data to the table.
So I made a few textboxes etc at the form and a button with this code:
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click
DoCmd.RunSQL "INSERT INTO tblSpecials ([PcodeId], [ContractId], [CalcCosts],
[CalcSales], [RelCosts], [RelSales], [Chance], [Results]) VALUES (" & Combo2
& " , " & ContractId & " , " & tbCalculatedCosts & " , " & tbCalculatedSales
& " , " & tbRealizedCosts & " , " & tbRealizedSales & " , " & tbChance & " ,
" & tbResults & ")"
Exit_Command32_Click:
Exit Sub
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
End Sub
This worked out fine for the Number values (the columns that have a "number
data type" in the table). All data is nicely appended.
Q1) Although for text fields it doesn't work. When I want to append
text-fields I receive a pop up screen where I can prompt the text in. When I
do so it does work, but ofcourse this isn't really a solution to the problem.
Q2) When I don't enter a value in one of the fields (text or number) I
receive an error message "syntax error in insert into statement". While the
columns in the table are NOT required (or key columns).
Very strange to me:S
Hopefully someone can help me with this!
I would be very gratefull,
- Onne
I faced another problem which I can't solve on my own.
I got a table and a form. I want to use the form to append data to the table.
So I made a few textboxes etc at the form and a button with this code:
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click
DoCmd.RunSQL "INSERT INTO tblSpecials ([PcodeId], [ContractId], [CalcCosts],
[CalcSales], [RelCosts], [RelSales], [Chance], [Results]) VALUES (" & Combo2
& " , " & ContractId & " , " & tbCalculatedCosts & " , " & tbCalculatedSales
& " , " & tbRealizedCosts & " , " & tbRealizedSales & " , " & tbChance & " ,
" & tbResults & ")"
Exit_Command32_Click:
Exit Sub
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
End Sub
This worked out fine for the Number values (the columns that have a "number
data type" in the table). All data is nicely appended.
Q1) Although for text fields it doesn't work. When I want to append
text-fields I receive a pop up screen where I can prompt the text in. When I
do so it does work, but ofcourse this isn't really a solution to the problem.
Q2) When I don't enter a value in one of the fields (text or number) I
receive an error message "syntax error in insert into statement". While the
columns in the table are NOT required (or key columns).
Very strange to me:S
Hopefully someone can help me with this!
I would be very gratefull,
- Onne