Hi John,
Thanks for fast response.
Not sure I understand what you mean, please elaborate.
Concatenating a literal ' character, a free form text string, and a literal '
character, as you are doing, will generate a string like
'Go to friend's house'
The apostrophe in friend's is seen as the closing apostrophe for the string.
Your alternative is to use a " character as the string delimiter, instead of
using a singlequote ' character: you want
"Go to friend's house"
delimited by doublequotes.
To get a string delimited by doublequotes, you must use TWO CONSECUTIVE
doublequotes in the literal string: rather than
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 & "');"
try
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 & """);"
Note: before and after Remarks_Text I am suggesting that you put """ - three
consectuive doublequote characters. Two consecutive doublequotes within a
string will be converted to one doublequote.
My question from the previous post still remains:
You're using complicated VBA code and an append query to do something that
Access does for you FOR FREE, with *no* code, *no* queries, *no* complicated
double-doublequotes. WHY are you doing so? You're apparently wasting a whole
lot of time and effort; maybe you have a good reason to do so but I do not
understand what it might be!