473,763 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_at tend_hospital_i n_clinical_emer gencies+[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 1867
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_at tend_hospital_i n_clinical_emer gencies+[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.Openr ecordset(....
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
2743
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: addleadingzeros_arr($arr); // and have the output look like:
5
11511
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 anticipation, Regards,
2
1599
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 find anything online on the subject... <asp:TextBox id="txtRefNum" runat="server"></asp:TextBox> I thought I could use a validator for the process and make the user add the zeros, but of course that is a big no-no! Please help!!
6
1415
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 find anything online on the subject... <asp:TextBox id="txtRefNum" runat="server"></asp:TextBox> I thought I could use a validator for the process and make the user add the zeros, but of course that is a big no-no! Please help!!
15
20104
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
7764
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 each file that he has us process. He wants this in a Comma Delimited Format.
3
9921
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 in the Edit option, then all the zeros containing the numbers 360, 90, 502, etc. will be deleted. Some nice person helped me with the following code to delete the zeros: Selection.Replace What:="0", Replacement:="" , but unfortunately this code...
0
4105
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 = "SELECT * FROM " sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Microsoft.VisualBasic.FileIO.FileSystem.GetParentPath(msFile) & _
5
8749
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 javascript but my current conflict is that our barcode scanner reads "785" as "00785." I've tried everything to filter out the zeros: regexp, converting to integer and multiplying/dividing by 1, and a couple other sidewall experimental approaches but the...
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.