here is my project
now i try to insert data into Order table using click event
of button on Main form in my project.
in my project i have order form and order table.
i can only insert data if i change my table name to
order1.
i don't want to change talbe name
any solution??
Below is my Click event code.
Code:
Private Sub Command127_Click()
Dim StrSQL As String
Dim InDate As String
InDate = Format(Date, "dd-MM-yyyy")
'this doesn't work because i think may be form name and table name are same
'what shoul i have to do?? i don't want to change table name.
StrSQL = " INSERT INTO Order1([CustomerID],[EmployeeID],[OrderDate],[RequiredDate],[FinishedDate],[Tax],[OtherAmount],[Diary],[Note],[LastEditDate]) VALUES (1,1,#" & InDate & "#,#" & InDate & "#,#" & InDate & "#,10,450,'Diary','Note',#" & InDate & "#)"
'It works if i change table name to Order1
'StrSQL = " INSERT INTO Order1([CustomerID],[EmployeeID],[OrderDate],[RequiredDate],[FinishedDate],[Tax],[OtherAmount],[Diary],[Note],[LastEditDate]) VALUES (1,1,#" & InDate & "#,#" & InDate & "#,#" & InDate & "#,10,450,'Diary','Note',#" & InDate & "#)"
DoCmd.SetWarnings False
DoCmd.RunSQL StrSQL
DoCmd.SetWarnings True
End Sub