By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

Zeros not updating

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.