null returned from zero input ?

G

Guest

I am using the html form below to pull data from an access database.

<input name="hours_wujiquan" type="text" id="hours_wujiquan"
value="<cfoutput>#EditMember.hours_wujiquan#</cfoutput>"> Wujiquan Hours<br />

The input code placed a zero into the field "hours_wujiquan" but the access
database displays a blank in the field. When the form is brought up from a
webpage, the field is shown to be blank rather than zero. This requires the
user to re-type zero into the field every time or the form fails - even if
they do not want to update the zero value field, they must type this zero in
or the form submission fails - I do not understand the NZ functions talked
about in these forums - the coding i do is strictly webpage based so I need a
way to have the database display a zero in the field since that is what I
want - not null.... I really know little about the programming of Access in
the application - i need a way to get this done outside the application
structure - many thanks - Kevin - Dallas, TX
 
6

'69 Camaro

Hi, Kevin.
I am using the html form below to pull data from an access database.

<input name="hours_wujiquan" type="text" id="hours_wujiquan"
value="<cfoutput>#EditMember.hours_wujiquan#</cfoutput>"> Wujiquan
Hours<br />

To "pull the data" from an Access database, one needs a SQL query and a
proper connection string to the data source. The code you posted doesn't do
either of those things.
The input code placed a zero into the field "hours_wujiquan" but the
access
database displays a blank in the field. When the form is brought up from
a
webpage, the field is shown to be blank rather than zero. This requires
the
user to re-type zero into the field every time or the form fails

The Web page developer must assign the zero value to the Web page text boxes
that have blanks for the corresponding fields. Access can't do it for the
Web application. Access is storing either a NULL or a zero length string
and has no jurisdiction over how non-Access applications display that data.
I do not understand the NZ functions talked
about in these forums - the coding i do is strictly webpage based so I
need a
way to have the database display a zero in the field since that is what I
want - not null

The NZ( ) function is a VBA function, which may not be available in your
chosen scripting language. I suggest you post a question in a newsgroup for
your particular scripting language to find out how to assign a zero value to
the Web page's input boxes that are blank.
I really know little about the programming of Access in
the application

You don't need to know how to program Access to build a proper Web-based
database application, but you do need to know SQL for your queries.
i need a way to get this done outside the application
structure

As I suggested above, post in an appropriate newsgroup for your Web
scripting language, because Access can't control how your Web page displays
the data it stores.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

sorry Gunny, I wasn't clear enough - i have a good DSN connection and all
works perfectly - my script is good - the problem is that the data in the
access database is not persistant but only when the value is 0 (zero) - the
database accepts and retains a zero value in numerical fields when placed
there manually but loses the data after an SQL query is run against the
database.... after a single query against the DB, the value is no longer zero
but rather has turned to a blank empty field - possibly null or even empty
but not sure about that... all i know is that I am running good basic SQL
queries against the DB and it changes the data condition somehow - what is
going on ??

Kevin
 
6

'69 Camaro

Hi, Kevin.
the problem is that the data in the
access database is not persistant but only when the value is 0 (zero)

I'm guessing by "not persistent" you mean that executing an UPDATE query
doesn't change the current record in the Access (Jet, really) table to the
values that the Web user typed into the text boxes, or when executing an
INSERT query, the Web user's record isn't saved, unless the blank values are
manually changed to 0 before query execution. If so, then it means that the
query fails because the blank column is required, or it fails a table
constraint, or it fails a table or column validation rule.
the
database accepts and retains a zero value in numerical fields when placed
there manually but loses the data after an SQL query is run against the
database

By running a SQL query against the database, I'm guessing you mean executing
an UPDATE or INSERT query, not a SELECT query.
after a single query against the DB, the value is no longer zero
but rather has turned to a blank empty field - possibly null or even empty

I'm guessing you mean executing a SELECT query with the Web page to retrieve
the data right after it's been inserted or updated, and even though the
INSERT or UPDATE query put a 0 in the column, the SELECT query shows the
record, but the one column should show 0 and instead it's showing a blank
(NULL if numeric, zero length string if text) in that Web page's text box.

Please let me know if my guesses are right or wrong.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Correct on all accounts - I m INSERTing a zero value and but when SELECTing
the query for an UPDATE - the form is blank instead of having a zero value in
it.... upon inspection of the database, the field is also blank - my SQL
funstions against the DB all work very well with anything except zero - I can
insert, update, delete without dificulty - it is simply unacceptable for me
to ask a user to type in a zero into a field for an UPDATE function every
time - when the data (zero) should already be there loaded - just like all
the other non-zero data is already.... I think you get me now - any solutions
for getting the 0 (zero) to show up in my webpage form fields instead of a
blank when a zero has been inout to the access DB ??

thanks mucho for any insight here.

Kevin
 
G

Guest

:

This requires the
user to re-type zero into the field every time or the form fails - even if
they do not want to update the zero value field, they must type this zero in
or the form submission fails


you may have to do a If IsNull statement to tell the field taht if it IsNull
it is realy 0 or something along thouse lines
 
G

Guest

I have tried a couple of things like this with no luck - i am really
somewhat amazed that this is not a well-known solution... allowing a database
to display a zero value would seem like a very normal thing to be able to do
- it all seems a little strange that this has taken such an effort to attack
- i have been searching the web for days with no solution to this - I thought
for a long time that I was just missing something stupid and it would hit me
in the head soon - but it appears that this is a problem - i am wondering now
if this is a problem for Access alone or a database general problem ???

If anyone has working code for an HTML page that will test for a null value
and replace with a ZERO in the form field - you will be my personal hero !

Kevin
 
G

Guest

It's pretty cheesy but it works.... (This is cold fusion code but the idea is
simple enough) - Kevin

<!-- Test if variable is Null from database - if is a Null value, assign
ZERO for html form input -->
<cfif VARIABLE GTE 1>
<cfset VARIABLE= VARIABLE>
<cfelse>
<cfset VARIABLE= 0>
</cfif>
 

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