Hi,
I'd like to make a valuation of database records. Suppose you have a
table:
Name Must have
Address Should have
Zip Should have
SocialSecNr Must have
City Should have
State Should have
Salary Must have
Carbrand Would have
Kids_YN Would have
Holiday_dest Would have
Now I want to give a number to every record, that gives me an idea how
far the data is supplied. The musthave-fields give me (say) 7 points,
shouldhave-fields 4 points, and wouldhave-fields 1 point.
So the following records gives me (maximum 40 points):
Name Mark Johnson --> 7 points
Address 123 Broadway --> 4 points
Zip
SocialSecNr
City NYC --> 4 points
State
Salary
Carbrand
Kids_YN YES --> 1 points
Holiday_dest Norway --> 1 points
17 points for this record.
This way, I can valuate the way our datacollection program is making
progress.
Does anyone has an idea how to implement this?
Thanks for any suggestions. 6 1380
Create a form with a button and a textbox (TbxScore)
in the on click even of the button:
Dim Dbs as Database
Dim Rst as Recordset
Dim Qry as String
Set Dbs = "c:\whatever.mdb"
Qry = "SELECT * FROM Tbl"
Set Rst = dbs.opendatabase(Qry, dbopendynaset)
If not IsNull(Rst) then
.MoveFirst
While Not Rst.eof
If IsNull(!Name) Then
TbxScore.Value = 0
Else
TbxScore.value = 7
End If
If not IsNull(!Address) Then
TbxScore.value = TbxScore.value + 7
End if
etc.....
Do something with your calculated value and reset
tbxScore.value = 0
.MoveNext
Wend
.Close
End If
I deliberately mixed up the use of the IF statement so that you can
decide what you want to do. Also you need to do something with this
value you are calculating, otherwise it will just display in your form.
This is just a guideline and I have not checked anything.
Is this something that could be done in a query? Like in Oracle
select nvl(address,0,7) + nvl(name,0,7)
from mytable;
??
regards paul al********@it4us.nl wrote: Is this something that could be done in a query? Like in Oracle select nvl(address,0,7) + nvl(name,0,7) from mytable; ??
Lookup "Nz Function" in help while in the VBA IDE.
Got it. I was actually looking for
Select
IIf(IsNull([tblTest].[Address])=True,0,4) +
IIf(IsNull([tblTest].[Name])=True,0,7)
from tblTest
Now I got it working. Thanks. al********@it4us.nl wrote: Got it. I was actually looking for
Select IIf(IsNull([tblTest].[Address])=True,0,4) + IIf(IsNull([tblTest].[Name])=True,0,7) from tblTest
Now I got it working. Thanks.
When using IIf, Isnull returns a boolean result so you wouldn't need the
"=True" bit in there, so:
IIf(IsNull([tblTest].[Address]),0,4)
will work and shave a few nanoseconds off each row.
--
[OO=00=OO]
<al********@it4us.nl> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Got it. I was actually looking for
Select IIf(IsNull([tblTest].[Address])=True,0,4) + IIf(IsNull([tblTest].[Name])=True,0,7) from tblTest
Now I got it working. Thanks.
Depending on how you have your fields set up, you may have strings of
zero-length or containing only spaces, so you could have:
IIF(Len(Trim(Nz(MyField)))=0,0,4) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bridget Willey |
last post by:
I am using ACT 6 and am trying to "split" the database between records
for customers and junk records. The accounts designated as "customers"
have that word in the ID field, and I am using that...
|
by: John |
last post by:
Hi All,
I have two backend databases that area link to a frontend database
where information is entered, retrieved and deleted. The information
accessed from the frontend database is coming from...
|
by: PC Datasheet |
last post by:
Looking for suggestions ----
A database was designed for a national automobile inspection program. In
it's simplest form, the database has two tables:
TblOwner
OwnerID
<Year/Make/Model owned...
|
by: MP |
last post by:
Greets,
context: vb6/ado/.mdb/jet 4.0 (no access)/sql
beginning learner, first database, planning stages
(I think the underlying question here is whether to normalize or not to
normalize this...
|
by: Sam |
last post by:
Hi all,
I have a process which first pulls one time all application IDs from a
database and stores them in a table(this process works fine everytime). I
then loop through the table, one at a...
| |
by: vonclausowitz |
last post by:
Hi All,
I was thinking of creating a table in my database to index all words in
the database.
That way I can quickly search for one or more words and the index table
will return the
words and...
|
by: Jim Devenish |
last post by:
I have a split front end/back end system. However I create a number of
local tables to carry out certain operations. There is a tendency for
the front end to bloat so I have set 'compact on...
|
by: ianenis.tiryaki |
last post by:
well i got this assignment which i dont even have a clue what i am
supposed to do. it is about reading me data from the file and load
them into a parallel array here is the question:
Step (1)
...
|
by: tamaker |
last post by:
Is this do-able with ASP / VBscript?
-- I have a database with user records (name, photo, etc. etc.)
I want to use asp to generate (on the homepage) a series of 4 randomly
selected 'user...
|
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,...
|
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,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |