Field value shifting to right by one place each time I am saving d

J

Jack

Hi,
This is a strange problem I am encountering. I have a asp page with a
confirmation.asp page that saves data to a table. There are few text fields
that are captured by the confirmation page as
l_f_name = Request.Form("txt_Name")
l_f_personstitle = Request.Form("txt_Title")
l_f_PhoneAreaCode = Request.Form("txt_PhoneAreaCode")
l_f_Phone1 = Request.Form("txt_Phone1")
l_f_Phone2 = Request.Form("txt_Phone2")
l_f_Date = Request.Form("txt_Date")

while the same confirmation page updates the data in a database where the
sql statement is



strSQL1 = "UPDATE tblGMISExpenditures_Quarter SET
tblGMISExpenditures_Quarter.CurrentOutlay= '" & l_CurrentOutlay & "' " & _
", tblGMISExpenditures_Quarter.LocalShare= '" &
l_CurrentLocalShareOutlay & "' " & _
", tblGMISExpenditures_Quarter.MBCCShare= '" &
l_c_MBCCShareOfOutlay & "' " & _
", tblGMISExpenditures_Quarter.UnpaidOblig= '" &
l_CurrentUnpaidObligations & "' " & _
", tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '" &
l_CurrentLocalShareUnpaidObligations & "' " & _
", tblGMISExpenditures_Quarter.ProjectIncome= '" &
l_CurrentOtherProjectIncomeReceived & "' " & _
", tblGMISExpenditures_Quarter.ForfeitureIncome= '" &
l_CurrentForfeitureIncomeReceived & "' " & _
", tblGMISExpenditures_Quarter.OtherExpense= '" &
l_CurrentOtherProjectIncomeExpenditures & "' " & _
", tblGMISExpenditures_Quarter.ForfeitureExpense= '" &
l_CurrentForfeitureIncomeExpenditures & "' " & _
", tblGMISExpenditures_Quarter.InterestReceived= '" &
l_CurrentInterestIncomeReceivedOnMBCCFunds & "' " & _
", tblGMISExpenditures_Quarter.TotalPeriodOutlay= '" &
l_p_c_TotalOutlay & "' " & _
", tblGMISExpenditures_Quarter.Remarks= ' " & l_f_Remarks & " '
" & _
", tblGMISExpenditures_Quarter.Name= ' " & l_f_Name & " ' " & _
", tblGMISExpenditures_Quarter.Title= ' " & l_f_personstitle & "
' " & _
", tblGMISExpenditures_Quarter.AreaCode= ' " & l_f_PhoneAreaCode
& " ' " & _
", tblGMISExpenditures_Quarter.Phone1= ' " & l_f_Phone1 & " ' "
& _
", tblGMISExpenditures_Quarter.Phone2= ' " & l_f_Phone2 & " ' "
& _
", tblGMISExpenditures_Quarter.Date= '" & l_f_Date & "' " & _
" where " & _
" tblGMISExpenditures_Quarter.SubgrantIntID = " & GrantID & ";"

Now, why after saving the data, for the stated fields, data is shifting in
the right by one space? Looking for some resolution and cause. Thanks in
advance. Regards.
 
M

Mark Schupp

Could be that the form fields are adding a blank somewhere when you display
the form.

Try trimming the data as in:

Trim(Request.Form("txt_Name"))
 
J

Jack

Thanks for the advise Mark. I appreciate it. Now, after doing a trim command
to each of the text field capture, the problem is solved. However, still I am
finding that in each of the text field, there is one space left and then the
data starts filling in. At least, this time the shifting data problem is
solved. However, I am wondering in spite of trim function applied, why should
be there one space and then data in both form and the database table. Any
further thoughts. Thanks. Regards.
 
J

Jack

Thanks Curt for your reply. Let me check whether this change can do the
trick. Regards.
 
D

Dave Anderson

Jack said:
I am wondering in spite of trim function applied, why should be
there one space and then data in both form and the database table.

This can happen if there is whitespace in the source HTML. Two scenarios:

<input type="text" value=" <%=MyVar%> ">
<textarea><%=MyVar%>
</textarea>

In the text input case, the whitespace is fairly clear. With a textarea,
it's not quite as obvious. View source on the confirmation page and see
what's there.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
J

Jack

After testing, I find that it works now. However, I forgot to tell that
remarks is a memo field in access. In spite of implementing the change the
field seems to leave one space before adding data. Is this common with a memo
field? Thanks for your help.
 
J

Jack

Hi Dave,
Thanks for your advise. I got the anwer from Curt, well almost. Stil the
remark field is not trimming the leading space(one). Do you think, memo field
does throw in one space before the data? Thanks.
 
D

Dave Anderson

Jack said:
...the remark field is not trimming the leading space(one). Do you
think, memo field does throw in one space before the data? Thanks.

Unless you show us some of the relevant ASP code, we can come up with
speculative reasons for days. Focusing on just one affected field, can you
show the line in your confirmation page that displays that field? How about
the line(s) associated with putting that field into the database?



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
J

Jack

Dave,
Here is the data capture from the form.
l_f_Remarks = trim(Request.Form("txt_Remarks"))
and here is the corresponding statement for database update. Hope this helps.
Regards

strSQL1 = "UPDATE tblGMISExpenditures_Quarter SET
tblGMISExpenditures_Quarter.CurrentOutlay= '" & l_CurrentOutlay & "' " & _
", tblGMISExpenditures_Quarter.LocalShare= '" &
l_CurrentLocalShareOutlay & "' " & _
", tblGMISExpenditures_Quarter.MBCCShare= '" &
l_c_MBCCShareOfOutlay & "' " & _
", tblGMISExpenditures_Quarter.UnpaidOblig= '" &
l_CurrentUnpaidObligations & "' " & _
", tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '" &
l_CurrentLocalShareUnpaidObligations & "' " & _
", tblGMISExpenditures_Quarter.ProjectIncome= '" &
l_CurrentOtherProjectIncomeReceived & "' " & _
", tblGMISExpenditures_Quarter.ForfeitureIncome= '" &
l_CurrentForfeitureIncomeReceived & "' " & _
", tblGMISExpenditures_Quarter.OtherExpense= '" &
l_CurrentOtherProjectIncomeExpenditures & "' " & _
", tblGMISExpenditures_Quarter.ForfeitureExpense= '" &
l_CurrentForfeitureIncomeExpenditures & "' " & _
", tblGMISExpenditures_Quarter.InterestReceived= '" &
l_CurrentInterestIncomeReceivedOnMBCCFunds & "' " & _
", tblGMISExpenditures_Quarter.TotalPeriodOutlay= '" &
l_p_c_TotalOutlay & "' " & _
", tblGMISExpenditures_Quarter.Remarks= '" & l_f_Remarks & "' " & _
", tblGMISExpenditures_Quarter.Name= '" & l_f_Name & "' " & _
", tblGMISExpenditures_Quarter.Title= '" & l_f_personstitle & "' "
& _
", tblGMISExpenditures_Quarter.AreaCode= '" & l_f_PhoneAreaCode &
"' " & _
", tblGMISExpenditures_Quarter.Phone1= '" & l_f_Phone1 & "' " & _
", tblGMISExpenditures_Quarter.Phone2= '" & l_f_Phone2 & "' " & _
", tblGMISExpenditures_Quarter.Date= '" & l_f_Date & "' " & _
" where " & _
" tblGMISExpenditures_Quarter.SubgrantIntID = " & GrantID & ";"
 
D

Dave Anderson

Jack said:
l_f_Remarks = trim(Request.Form("txt_Remarks"))

Have you examined Server.HTMLEncode(l_f_Remarks) ?


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
J

Jack

Mark, here is the way I am displaying the remarks field. Thanks. Regards.

l_Remarks = RSCurrentExpense.Fields("Remarks")
<textarea rows="9" name="txt_Remarks" cols="106"> <%Response.Write
(trim(l_Remarks))%></textarea>
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top