Unable to do insert queries

  • Thread starter edisonl via AccessMonster.com
  • Start date
E

edisonl via AccessMonster.com

Hi there,

I am unable to execute an INSERT queries for a docmd.runquery
"AddLeave_Query"

Any idea what might be the possible issue ?

Other insert statement is ok

Regards, Edison
 
A

Allen Browne

What error message do you get? Does it tell you what's wrong?

If you don't get any message, make sure you have not turned SetWarnings off.

Once you get the error message, this page may help you understand what to
look for after that:
Why can't I append some records?
at:
http://allenbrowne.com/casu-19.html
 
K

KARL DEWEY

Any idea what might be the possible issue ?
It is hard for anyone to say being this far away from the screen. If you
posted the SQL of your query it might be alittle clearer.
 
P

pietlinden

It is hard for anyone to say being this far away from the screen.  If you
posted the SQL of your query it might be alittle clearer.

Karl,
if you squint just right, you can see it. <g>
 
E

edisonl via AccessMonster.com

Hi KARL,

strsql = "INSERT INTO PendingLeave_Table(UserID,LeaveType,AppliedTime,
AppliedDate,AppliedBy,[FromDate],[ToDate],TotalDays,Approve,[ApprovedTime],
[ApprovedDate],Remarks) VALUES('" & _
Forms!login_form!ApplicantUserID_Text & "','" & Forms!login_form!
LeaveType_ComboBox.Value & "','" & applytime & "','" & applydate & "','" & _
Forms!login_form!UserName_Text & "','" & FromDate_Text & "','" & ToDate_Text
& "','" & TotalDay_Text & "',0, '0:00', '00/00/00' ,'" & Remarks_Text & "');"


By the way, it seems funny, I had lots of others user using similar SQL that
execute above lines with no issue..

Regards, Edison

* * * * * * * * * * * * * * * * * *
KARL said:
It is hard for anyone to say being this far away from the screen. If you
posted the SQL of your query it might be alittle clearer.
Hi there,
[quoted text clipped - 6 lines]
Regards, Edison
 
E

edisonl via AccessMonster.com

Hi KARL,

strsql = "INSERT INTO PendingLeave_Table(UserID,LeaveType,AppliedTime,
AppliedDate,AppliedBy,[FromDate],[ToDate],TotalDays,Approve,[ApprovedTime],
[ApprovedDate],Remarks) VALUES('" & _
Forms!login_form!ApplicantUserID_Text & "','" & Forms!login_form!
LeaveType_ComboBox.Value & "','" & applytime & "','" & applydate & "','" & _
Forms!login_form!UserName_Text & "','" & FromDate_Text & "','" & ToDate_Text
& "','" & TotalDay_Text & "',0, '0:00', '00/00/00' ,'" & Remarks_Text & "');"


By the way, it seems funny, I had lots of others user using similar SQL that
execute above lines with no issue..

Regards, Edison

* * * * * * * * * * * * * * * * * *
KARL said:
It is hard for anyone to say being this far away from the screen. If you
posted the SQL of your query it might be alittle clearer.
Hi there,
[quoted text clipped - 6 lines]
Regards, Edison
 
J

John W. Vinson

Hi KARL,

strsql = "INSERT INTO PendingLeave_Table(UserID,LeaveType,AppliedTime,
AppliedDate,AppliedBy,[FromDate],[ToDate],TotalDays,Approve,[ApprovedTime],
[ApprovedDate],Remarks) VALUES('" & _
Forms!login_form!ApplicantUserID_Text & "','" & Forms!login_form!
LeaveType_ComboBox.Value & "','" & applytime & "','" & applydate & "','" & _
Forms!login_form!UserName_Text & "','" & FromDate_Text & "','" & ToDate_Text
& "','" & TotalDay_Text & "',0, '0:00', '00/00/00' ,'" & Remarks_Text & "');"


By the way, it seems funny, I had lots of others user using similar SQL that
execute above lines with no issue..

Please indicate the actual error message that you received. If you're
inserting text values, might some of them contain the ' apostrophe character?
That will cause an error since you're using ' as a delimiter. In addition, why
are you inserting text strings into a Date field? Is ApprovedDate in fact a
Date/Time field in the table? If so, be aware that '00/00/00' is NOT a valid
date value and will cause an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top