J
Johnny Bright
Hi there!
I'm trying to do the following. The form this code comes from is not bound
to any table and when I try to execute the code I get "Run Time Error 3075
Syntax Error in string in query expression '100000")'.
100000 is the number I have typed into the txtPrincipal text box. I
commented out a large block of the code to try a simpler example.
Private Sub cmdAdd_Click()
Dim MyDB As DAO.Database
'Dim rs As DAO.Recordset
Set MyDB = CurrentDb
' MyDB.Execute "Insert Into tblInt (Principal, Rate, Periods, IntEarned,
" _
' & "AmtEarned, Freq) Values (" _
' & [txtPrincipal] & ", " _
' & [txtInterestRate] & ", " _
' & [txtPeriods] & ", " _
' & [txtInterestEarned] & ", " _
' & [txtAmountEarned] & ", " _
' & [FraFrequency] & " "")"
MyDB.Execute "Insert Into tblInt (Principal) Values (" _
& [txtPrincipal] & " "") "
End Sub
Did I miss a comma or a quote somewhere or do I actually need to use a
recordset variable somewhere.
All help greatly appreciated!
John
I'm trying to do the following. The form this code comes from is not bound
to any table and when I try to execute the code I get "Run Time Error 3075
Syntax Error in string in query expression '100000")'.
100000 is the number I have typed into the txtPrincipal text box. I
commented out a large block of the code to try a simpler example.
Private Sub cmdAdd_Click()
Dim MyDB As DAO.Database
'Dim rs As DAO.Recordset
Set MyDB = CurrentDb
' MyDB.Execute "Insert Into tblInt (Principal, Rate, Periods, IntEarned,
" _
' & "AmtEarned, Freq) Values (" _
' & [txtPrincipal] & ", " _
' & [txtInterestRate] & ", " _
' & [txtPeriods] & ", " _
' & [txtInterestEarned] & ", " _
' & [txtAmountEarned] & ", " _
' & [FraFrequency] & " "")"
MyDB.Execute "Insert Into tblInt (Principal) Values (" _
& [txtPrincipal] & " "") "
End Sub
Did I miss a comma or a quote somewhere or do I actually need to use a
recordset variable somewhere.
All help greatly appreciated!
John