473,320 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Zeros not updating

I'm a novice Access user and am not sure how to solve the following problem.
Any help with the following would be greatly appreciated!

I have two tables with identical structures, the first holds the data input
for a questionnaire, the second holds the scores from the questionnaire, to
move the scores I've set up 2 action queries, the first appends the record
to the second table, the second action query 'updates' the results by
converting the various lookup table codes to the appropriate score (by using
a lot of iif statements).

I am a bit baffled by some of the results. Bearing in mind that I have set
default values for all of the fields in the main table (generally to 0), why
is it not updating the record set in all fields. The result is that I get
error messages when I run another query to total the scores for the record
due to some of the fields being blank/empty rather than storing a 0? I've
included an entry for 0 in all of my lookup tables. During various attempts
to fix this, I have included Nz, isempty, is null functions to try and force
zeros for the score query.

Also, another strange thing that happens: In my expression that totals the
records, on some of the field names which I put inside square brackets, the
brackets are disappearing. Could this be due to the fact that the
expression is pretty long? e.g. (brace yourself!)

total: IIf([Nights]="AUTO","AUTO",IIf([Live in Trust
Residence]="AUTO","AUTO",CStr(Sum([Scored car park records]![Time to walk to
public transport]+[Scored car park records]![Take Children to
school]+[Scored car park records]![Special
considerations_eg_mobility]+[Scored car park records]![Attend to
dependents]+[Scored car park records]![Call out duties]+[Scored car park
records]!required_to_attend_hospital_in_clinical_emergenci es+[Scored car
park records]![access to hosp to load/unload equipment]+[Scored car park
records]!Shift+[Scored car park records]![reg hours 7am to 6pm
Mon-Fri]+[Scored car park records]!ECU+[Scored car park records]![Distance
home-work]+[Scored car park records]![Public transport - Changes])))).

I'm wondering if renaming all of the fields will sort out the problem
(although I cringe when I think of the queries and reports that will have
to be amended....!)

Your help will be greatly appreciated!

Many thanks

Chrissie

Nov 13 '05 #1
1 1832
Chris Jackson wrote:
I'm a novice Access user and am not sure how to solve the following problem.
Any help with the following would be greatly appreciated!

I have two tables with identical structures, the first holds the data input
for a questionnaire, the second holds the scores from the questionnaire, to
move the scores I've set up 2 action queries, the first appends the record
to the second table, the second action query 'updates' the results by
converting the various lookup table codes to the appropriate score (by using
a lot of iif statements).

I am a bit baffled by some of the results. Bearing in mind that I have set
default values for all of the fields in the main table (generally to 0), why
is it not updating the record set in all fields. The result is that I get
error messages when I run another query to total the scores for the record
due to some of the fields being blank/empty rather than storing a 0? I've
included an entry for 0 in all of my lookup tables. During various attempts
to fix this, I have included Nz, isempty, is null functions to try and force
zeros for the score query.

Also, another strange thing that happens: In my expression that totals the
records, on some of the field names which I put inside square brackets, the
brackets are disappearing. Could this be due to the fact that the
expression is pretty long? e.g. (brace yourself!)

total: IIf([Nights]="AUTO","AUTO",IIf([Live in Trust
Residence]="AUTO","AUTO",CStr(Sum([Scored car park records]![Time to walk to
public transport]+[Scored car park records]![Take Children to
school]+[Scored car park records]![Special
considerations_eg_mobility]+[Scored car park records]![Attend to
dependents]+[Scored car park records]![Call out duties]+[Scored car park
records]!required_to_attend_hospital_in_clinical_emergenci es+[Scored car
park records]![access to hosp to load/unload equipment]+[Scored car park
records]!Shift+[Scored car park records]![reg hours 7am to 6pm
Mon-Fri]+[Scored car park records]!ECU+[Scored car park records]![Distance
home-work]+[Scored car park records]![Public transport - Changes])))).

I'm wondering if renaming all of the fields will sort out the problem
(although I cringe when I think of the queries and reports that will have
to be amended....!)

Your help will be greatly appreciated!

Many thanks

Chrissie


You might want to try this tactic. I assume you have only one, 1,
record to hold the results of a questionaire, the 2nd table holds all
results of the questionaire. When creating a new questionaire, run an
update query that puts zeros into all fields that are numeric.

We don't know what happens to the table that contains 1 record. A
default value is a value for the first time. After that, values can be
changed.

So...each time a new questionaire record is entered, first blank out the
values with 0. Otheriwse, don't use the append/update but use something
like
Dim rst As DAO.Recordset
set rst = Currentdb.Openrecordset(....
rst.AddNew
rst.QUestion1 = NZ(FieldName,0)
rst.Update
rst.Close

Nov 13 '05 #2

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

Similar topics

8
by: TheTeapot | last post by:
Hi all, Here's a puzzle: // Say I have an array of numbers set up like so: $arr = array(15,16,17,100,121,1000); // How can I create a function so that I can use it like so:...
5
by: samik_tanik | last post by:
I need to export a datagrid to Excel. I could did this. But, also need to keep the leading zeros in the data. How can I acheive this? Any help would be appreciated. -- Thanking you in...
2
by: Teep | last post by:
I have a simple text box called txtrefnum, if the user enters a number length less than 9 characters long than I need to have lead zeros added to it. Does anyone know how to do this? I couldn't...
6
by: TN Bella | last post by:
I have a simple text box called txtrefnum, if the user enters a number length less than 9 characters long than I need to have lead zeros added to it. Does anyone know how to do this? I couldn't...
15
by: Bob | last post by:
I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists. Bob
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
3
by: ManuelValdez | last post by:
Hello everybody! I need your valuable help to get an Excel macro to delete the single zeros only and no the zeros containing numbers like 360, 90, etc., because if I chose the search and replace...
0
by: Monty | last post by:
Hi All, I am having a problem with leading zeros being stripped from fields in a CSV file when I bring them in using Jet/OleDB. In VB.Net/VS 2008, I am accessing a CSV file like so: sSQL =...
5
n8kindt
by: n8kindt | last post by:
First of all, i haven't been to this site in a while and WOW is it much improved. I love all the new stuff--it looks great! I am all but done building a simple Point of Sale system through...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.