I am new in Microsoft Access and currently facing an error. I have no idea why I get this problem. Same code works well on another system.
When i input s898688j (example) in a IC number text box, it will give me run-time error '3061': Too few parameters. Expected 1
When i input 986343dd (example), i will give me run-time error'3075': Syntax error (missing operator) in query expression '986343dd'.
When i input 6986324 (example), the insert query is successful.
I think the error is from IC number. All the other field does not have any problem. I did not do any validation for my IC number yet as well
I have 2 tables
trainee table:
ID (autonumber),
full_name (text),
IC_num (text),
phone_no (text),
company_name (text)
course table:
course_id (autonumber),
IC_num (text),
course_name (text),
L3_survey (number),
L4_survey (number),
start_date (date/time),
end_date (date/time),
no_of_days (number)
Insert query in VBA:
For trainee:
CurrentDb.Execute "INSERT INTO trainee(IC_num, full_name, phone_no, company_name)" & _
" VALUES (" & Me.newIC & ",'" & Me.newName & "','" & _
Me.newPhone & "','" & Me.newCom & "')"
For course:
CurrentDb.Execute "INSERT INTO course(IC_num, course_name, L3_survey, L4_survey, start_date, end_date, no_of_days)" & _
" VALUES (" & Me.newIC & ",'" & Me.newCou & "','" & _
Me.newL3 & "','" & Me.newL4 & "','" & Me.newStrt & "','" & Me.newEnd & "','" & Me.newDay & "')"
I had tried a lot of ways but i have no idea why is it not working!!! :banghead:
When i input s898688j (example) in a IC number text box, it will give me run-time error '3061': Too few parameters. Expected 1
When i input 986343dd (example), i will give me run-time error'3075': Syntax error (missing operator) in query expression '986343dd'.
When i input 6986324 (example), the insert query is successful.
I think the error is from IC number. All the other field does not have any problem. I did not do any validation for my IC number yet as well
I have 2 tables
trainee table:
ID (autonumber),
full_name (text),
IC_num (text),
phone_no (text),
company_name (text)
course table:
course_id (autonumber),
IC_num (text),
course_name (text),
L3_survey (number),
L4_survey (number),
start_date (date/time),
end_date (date/time),
no_of_days (number)
Insert query in VBA:
For trainee:
CurrentDb.Execute "INSERT INTO trainee(IC_num, full_name, phone_no, company_name)" & _
" VALUES (" & Me.newIC & ",'" & Me.newName & "','" & _
Me.newPhone & "','" & Me.newCom & "')"
For course:
CurrentDb.Execute "INSERT INTO course(IC_num, course_name, L3_survey, L4_survey, start_date, end_date, no_of_days)" & _
" VALUES (" & Me.newIC & ",'" & Me.newCou & "','" & _
Me.newL3 & "','" & Me.newL4 & "','" & Me.newStrt & "','" & Me.newEnd & "','" & Me.newDay & "')"
I had tried a lot of ways but i have no idea why is it not working!!! :banghead:
Last edited: