Affichage des articles dont le libellé est Need help on Insert. Afficher tous les articles
Affichage des articles dont le libellé est Need help on Insert. Afficher tous les articles

Need help on Insert

lundi 4 mai 2015

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 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 had done all the research and i have no idea why there is error.

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:
Need help on Insert

Labels