Hi Friends,
I got a box of enter parameter value that requests to manual enter parameter value again
when I clicked submit buton. It works when i enter value into parameter box.
However, I already put data in each text fild and saw them by msgbox.
It seems that VBA does not reconiges theselocal declared parameter in RUNSQL command.
please help mw which wrong is about my code?
Thanks
newaccess
Private Sub Command20_Click()
Dim dbExercise As DAO.Database
Dim rstNWD As DAO.Recordset
Dim sale_CODE As Long
Dim sale_NUMBER As String
Dim sale_TYPE As String
Set dbExercise = CurrentDb
Set rstNWD = dbExercise.OpenRecordset("sale_transactions")
rstNWD.AddNew
sale_CODE = Me.sale_CODE
sale_NUMBER = Me.sale_NUMBER
sale_TYPE = Me.sale_TYPE
MsgBox sale_CODE
' inset data
DoCmd.RunSQL "insert into sale_TRANSACTIONS (sale_CODE, sale_NUMBER, sale_TYPE) values " & _
('sale_CODE', 'sale_NUMBER', 'sale_TYPE');"
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Set rstNWD = Nothing
Set dbExercise = Nothing
MsgBox "test add date "
End Sub
I got a box of enter parameter value that requests to manual enter parameter value again
when I clicked submit buton. It works when i enter value into parameter box.
However, I already put data in each text fild and saw them by msgbox.
It seems that VBA does not reconiges theselocal declared parameter in RUNSQL command.
please help mw which wrong is about my code?
Thanks
newaccess
Private Sub Command20_Click()
Dim dbExercise As DAO.Database
Dim rstNWD As DAO.Recordset
Dim sale_CODE As Long
Dim sale_NUMBER As String
Dim sale_TYPE As String
Set dbExercise = CurrentDb
Set rstNWD = dbExercise.OpenRecordset("sale_transactions")
rstNWD.AddNew
sale_CODE = Me.sale_CODE
sale_NUMBER = Me.sale_NUMBER
sale_TYPE = Me.sale_TYPE
MsgBox sale_CODE
' inset data
DoCmd.RunSQL "insert into sale_TRANSACTIONS (sale_CODE, sale_NUMBER, sale_TYPE) values " & _
('sale_CODE', 'sale_NUMBER', 'sale_TYPE');"
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Set rstNWD = Nothing
Set dbExercise = Nothing
MsgBox "test add date "
End Sub