Access 2003
The query below work, when it is in a saved query, but when I put it in VBA it gives me an error.
Syntaxt error into insert statement.
//////////////////////////////////////////////
Private Sub Input_Training_Records_Click()
Dim Dbs As DAO.Database
Set Dbs = CurrentDb
Dbs.Execute "INSERT INTO Table_Employee_Training_History
(Course_Name, Type_Of_Training, From_Date_Training,
To_Date_Training, SSN, Employee_First_Name,
Employee_Last_Name ) " & _
"SELECT '" & Forms!Training_Input!Course_Name_Combo_Box
& "' AS Course_Name, " & _
" '" & Forms!Training_Input!Type_Of_Training_Combo_Box_2
& "' AS Training_Input, " & _
" '" & Forms!Training_Input!From_Date & "' AS
From_Date_Training, " & _
" '" & Forms!Training_Input!To_Date & "' AS
To_Date_Training, " & _
"How_Many_Employees_Does_A_Suprvisor_Have.SSN, " & _
"How_Many_Employees_Does_A_Suprvisor_Have.[First Name], " & _
"How_Many_Employees_Does_A_Suprvisor_Have.[Last Name], " & _
" FROM How_Many_Employees_Does_A_Supervisor_Have);"
Dbs.Close
End Sub
The query below work, when it is in a saved query, but when I put it in VBA it gives me an error.
Syntaxt error into insert statement.
//////////////////////////////////////////////
Private Sub Input_Training_Records_Click()
Dim Dbs As DAO.Database
Set Dbs = CurrentDb
Dbs.Execute "INSERT INTO Table_Employee_Training_History
(Course_Name, Type_Of_Training, From_Date_Training,
To_Date_Training, SSN, Employee_First_Name,
Employee_Last_Name ) " & _
"SELECT '" & Forms!Training_Input!Course_Name_Combo_Box
& "' AS Course_Name, " & _
" '" & Forms!Training_Input!Type_Of_Training_Combo_Box_2
& "' AS Training_Input, " & _
" '" & Forms!Training_Input!From_Date & "' AS
From_Date_Training, " & _
" '" & Forms!Training_Input!To_Date & "' AS
To_Date_Training, " & _
"How_Many_Employees_Does_A_Suprvisor_Have.SSN, " & _
"How_Many_Employees_Does_A_Suprvisor_Have.[First Name], " & _
"How_Many_Employees_Does_A_Suprvisor_Have.[Last Name], " & _
" FROM How_Many_Employees_Does_A_Supervisor_Have);"
Dbs.Close
End Sub