472,981 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

Problem in Response.write statement to retrieve a field in a check

Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>
Jul 22 '05 #1
8 2569
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0
or something along those lines? If so, you have to put in logic to check to
see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes) then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>

Jul 22 '05 #2
Thanks a lot for the help, Ray. I used the following code as per your advise
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field? Thanks
again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0
or something along those lines? If so, you have to put in logic to check to
see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a

database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up

as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e.

yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>


Jul 22 '05 #3
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks a lot for the help, Ray. I used the following code as per your advise <td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field? Thanks again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0 or something along those lines? If so, you have to put in logic to check to see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a

database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up
as
it should. e.g.
if for the record the database has a checked field for
FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it

shows unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write CInt(l_FinalUpdate)%>"></td>
</tr>


Jul 22 '05 #4
The following is the view source result:

<tr>
<td><input TYPE="SUBMIT" NAME="btnSubmit" VALUE="SUBMIT"></td>
</tr>
This shows no value in the above.
Now, when I did a response.write l_finalupdate where this is the variable to
which
the value of Rs.Fields("FinalUpdate") is assigned, it gives a True results
instead of 1.
Any further thoughts. Thanks.

"Ray Costanzo [MVP]" wrote:
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks a lot for the help, Ray. I used the following code as per your

advise
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field?

Thanks
again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0 or something along those lines? If so, you have to put in logic to check to see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
> Hi,
> Here is my problem:
>
> I am logging in to a page, where the page retrieves a record from a
database.
> The text boxes are used in the display formto let the users update the
> fields,
> if they desire to.
>
> The colorpreference and foodpreference fields are text fields
> while the FinalUpdate field is a yes/no field in Access Database.
>
> While retieving the values, the FinalUpdate field value is not showing up as
> it should. e.g.
> if for the record the database has a checked field for FinalUpdate(i.e. yes)
> then the
> chkFinalUpdate checkbox in the form should be checked. Instead it shows > unchecked. I
> believe the code to retrive the value of the final update field is not
> correct.
>
> Any help is appreciated here for problem resolution. Regards
>
> RELEVANT CODE:
>
> <%
>
> 'Declare variables to store field values
>
> Dim l_ColorPreference
> Dim l_FoodPreference
> Dim l_FinalUpdate
>
> 'Get all the fields from the database in the above variable
>
>
> l_ColorPreference = RS.Fields("ColorPreference")
> l_FoodPreference = RS.Fields("FoodPreference")
> l_FinalUpdate = Rs.Fields("FinalUpdate")
> %>
>
> <!--In the HTML part display the values with proper formatting__>
>
> <td>Color Preference</td>
> <td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
> "<%Response.Write l_ColorPreference%>"></td>
>
> <td>Food Preference</td>
> <td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
> "<%Response.Write l_FoodPreference%>"></td>
> </tr>
>
> <tr>
> <td>FinalUpdate</td>
> <td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write > CInt(l_FinalUpdate)%>"></td>
> </tr>


Jul 22 '05 #5
You posted the view-source snippet for your submit button, not the checkbox
in question...

As far as the true/false, that's fine, but you were CInt'ing the value
before.

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
The following is the view source result:

<tr>
<td><input TYPE="SUBMIT" NAME="btnSubmit" VALUE="SUBMIT"></td>
</tr>
This shows no value in the above.
Now, when I did a response.write l_finalupdate where this is the variable to which
the value of Rs.Fields("FinalUpdate") is assigned, it gives a True results
instead of 1.
Any further thoughts. Thanks.

"Ray Costanzo [MVP]" wrote:
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

Jul 22 '05 #6
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write, then
it gave me a -1. I checked the value in the back-end and it shows checked in
the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>

Jul 22 '05 #7
Well, obviously -1 is not greater than 0... CBool it.

<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CBool(l_FinalUpdate) Then
Response.Write " checked"%>>

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write, then it gave me a -1. I checked the value in the back-end and it shows checked in the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving t

Jul 22 '05 #8
Ray, it works now. Many thanks for this. Regards.

"Ray Costanzo [MVP]" wrote:
Well, obviously -1 is not greater than 0... CBool it.

<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CBool(l_FinalUpdate) Then
Response.Write " checked"%>>

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write,

then
it gave me a -1. I checked the value in the back-end and it shows checked

in
the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving t


Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
4
by: JP SIngh | last post by:
Thanks to Manohar for writing the basic code for displaying the managers and the employees in a tree like structure. I have adapted the code below but it gives me an error "exception occcured"...
5
by: Raphael Gluck | last post by:
Hi I'm fairly new to coding in asp and i'm trying to create a simple if.. else... condition It's for asp web page, and is linked to my database, but i figured since it's a basic question, it...
17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Jack | last post by:
I am trying to debug a if else statement by using the following lines of code Response.Write RSreccountCurrentExpense("reccount") & "<br>" If RSreccountCurrentExpense("reccount") < 1 Then...
7
by: David Shorthouse | last post by:
I am attempting to create a "new account creation" asp, but would ideally like the routine to check the Access db for an existing email address and username (called UID below). The select query...
1
by: Steve | last post by:
HI I've run into a big problem I placed my webpage scripting in the code behind here i put out form tags with table linement stufffffffffffffff Response.Write("<form method=post...
5
by: znubbe | last post by:
Hi, I hope anyone can help me with this problem. I have a field of image type in a SQL 2000 database. I'm using this code to insert a document: Dim conn Dim rs Dim oStream
1
by: vinodkus | last post by:
vinod...@gmail.com wrote: Please stop shouting. Total records?? I think (hope) you mean "count of the total records". In
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.