我正在使表格在表格中插入記錄。我無法運行此查詢,因爲它向我顯示語法錯誤。我嘗試了很多,但無法找到錯誤。我的查詢如下。MS Access的SQL查詢中的語法錯誤
CurrentDb.Execute "
INSERT into Database2Sample(
nyu_id, location1, location2,
first_name, middle_name, last_name,
full_name, instructor_sis_id, instructor_email,
intstructor_net_id, personal_email, CV_link,
employee_nyu_global_site, highest_degree, degree_subject_area,
degree_status, degree_granting_institution, accomplishments,
Other_employee, WSQ_home_campus, teaching_language_course)
VALUES
('" & Me.nyu_id & "', '"
& Me.location1 & "', '"
& Me.location2 & "', '"
& Me.first_name & "', '"
& Me.middle_name & "', '"
& Me.last_name & "', '"
& Me.full_name & "', '"
& Me.instructor_sis_id & "', '"
& Me.instructor_email & "', '"
& Me.intstructor_net_id & "', '"
& Me.personal_email & "', '"
& Me.CV_link & "', '"
& Me.employee_nyu_global_site & "', '"
& Me.highest_degree & "', '"
& Me.degree_subject_area & "', '"
& Me.degree_status & "', '"
& Me.degree_granting_institution & "', '"
& Me.accomplishments & "', , '"
& Me.Other_employee & "', '"
& Me.WSQ_home_campus & "', '"
& Me.teaching_language_course & "')"
現在您的問題格式正確了,您應該返回並添加比您的少於通知的錯誤對話框更多的圖片。您需要添加錯誤日誌或有關錯誤的詳細信息,以及您所做的除了在問題上發表微弱嘗試之外的其他信息。 – apesa 2015-02-05 20:47:04
我建議首先將insert語句保存到字符串中,然後將字符串輸出到消息框窗口,然後通過查詢窗口排除故障。我會猜測你有一個缺失',一個數據類型轉換問題,或一個字段丟失的值,反之亦然。但要格式化上面的SQL是有點痛苦的。是21場,22個值。 – xQbert 2015-02-05 20:47:26