Hi, Allen,
LOL I was afraid I was right about the query. That will keep me busy for a
little while. And I figured more books would be necessary, no one supplies
manuals with their software anymore. Occasionally the PDF file on the CD's
somewhere. I find online help, either loaded on to my HD or, as MS does
these days, forces you to be online to get help access, essentially useless.
After the post, I went shopping, found MS"s Visual Basic for Access 97 and
ordered it. Shipping is costing 10 times the cost of the book.
I know the value of relational databases, and I wasn't offended by your
observation. I didn't create this database, it's something my brother-in-law
created. The very first iteration of it is so old..... It was started as a
Lotus 1-2-3 spreadsheet, then to Excel, and finally into Access. The first
database I ever created was on an Atari 8 bit.
Having the advantage of knowing what is in the database, I probably would
have created 3 tables. I've hinted about how they database could be much
more efficient, but it would require a couple simple changes no one wants to
tackle. Mired in the mud, shall we say.
I'm just trying to help him get the data out of Access. My observation is
people do not use a database program because Access is just about the only
one people know about as MS has just about driven everyone else out of
business or bought up the competition. And it's such a PITA to use.
I have a hunch the input form is the way it is since he's never figured out
how to get a report to give him the data he wants. So with the form he set
up, he can call up the record and print the screen. Really time consuming in
the long run.
If I could get my brother-in-law to switch to MS Works, it might be easier.
I've got other irons in the fire, but I'll see what I can accomplish on the
problem today.
Ken
Allen Browne said:
The short answer to your immediate question is, Yes: you need to build a
query with a calculated field. In query design, type an expression like
this:
TotalOffering: Nz([A],0) + Nz(
,0) + Nz([C],0) + ...
using your field names in place of A, B, and C. You can then filter on this
expression.
The longer answer is that if you have 35 columns with similar values, you
have built a spreadsheet in Access. That's not how you design a relational
database. This should be 2 tables:
- one that contains whatever the main thing is (a person? a group? a date?)
- a related table that contains the various values in one field, but in many
records.
You can then solve the whole thing in several really simple ways (e.g. a
totals query.)
An unbound form just means one that has nothing in its Record Source.
Consequently it is not getting data from a table or query. You would not use
an unbound form if you want to save records; but if you need an interface to
display a comment, or get a filter value, it's useful.
If you want to work with the event procedures, you will need to buy some
books again. That fire sounds nasty.
I can't emphasize enough how important it is to learn about using related
tables rahter than repeating columns. That's absolutely crucial. If you get
that right, you avoid many headaches: no VBA workarounds can substitute for
a relational data structure. Post more info about this table if you don't
understand how to normalize it. Or perhaps the table analyzer can make
suggestions (Tools menu.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Ken Springer said:
Hi, Allen,
OK, let's try this again. But I'm not going to get as detailed as last
night, in case the system crashes again.
The query option, as outlined in your post, doesn't work. That seems to
be
due to the fact the field, in the data entry form, I would like to check
for
a number greater than zero does not exist in the database table. It
exists
only in the form, where it sums the data in other fields in the table.
I called this a calculated field in the original post. The field, called
"Total Offering", sums the numbers from approximately 35 numerical fields
in
the table, and displays the total in the form display.
A simplified example of the database would be: There are 3 fields in the
table, A, B, and C. In the data entry form, you may or may not enter the
data in to A, B, and C. The default data is zero. But in the form only,
there is a 4th field, D, that displays the sum of the other 3 fields, i.e.
A
+ B + C. I need to see if the sum displayed in D is greater than zero.
If
it is greater than zero, I want specified data from that record to print.
If
the data is zero, null, anything else, the record is NOT to print.
Is that clear as mud????????? LOL
Am I going to have to build a query that first sums all the necessary
table
cells, check to see if it is greater than zero, and go from there?
Is there, somewhere on MS's site, a file that lists and explains the
commands used in the Event Procedure?
I need to figure out what an unbound form is too. LOL
Ken