473,385 Members | 1,772 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,385 software developers and data experts.

Basic help (i think)

Hi!

I'm building a db in access for a school project, and was wondering how to
make the value for a field the same as the number of records with the same
value in another field.
e.g.
DvdTitle = Pulp fiction
StockLev = 1

DvdTitle = Finding Nemo
StockLev = 2

DvdTitle = Finding Nemo
StockLev = 2
etc.

also (you can tell how little I've used access now...) how to say a currency
value(the price of each dvd)*a numeric value (the stock level) in the field
StockCost. I presume it is just "=Price*StockLev" in default value field.

Thankyou very much (in advance)
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003
Nov 12 '05 #1
3 1767
If table1 is the name of your table...

This a MAKE-TABLE Query

SELECT DISTINCTROW Table1.DvdTitle, Table1.StockLev, Count(*) AS [Count Of
Table1] INTO Table2
FROM Table1
GROUP BY Table1.DvdTitle, Table1.StockLev;

Then This query will populate the count field

UPDATE DISTINCTROW Table1 INNER JOIN Table2 ON Table1.DvdTitle =
Table2.DvdTitle SET Table1.StockLev = [Table2]![Count Of Table1];
About the Calculation...your evaluation is correct but it is not good
practice to stor calculations. Calculations can be displayed in form,
reports and queries as you have described. Use the Builder option in the
Query tool to properly build the formula.
Nov 12 '05 #2
> If table1 is the name of your table...

This a MAKE-TABLE Query

SELECT DISTINCTROW Table1.DvdTitle, Table1.StockLev, Count(*) AS [Count Of
Table1] INTO Table2
FROM Table1
GROUP BY Table1.DvdTitle, Table1.StockLev;

Then This query will populate the count field

UPDATE DISTINCTROW Table1 INNER JOIN Table2 ON Table1.DvdTitle =
Table2.DvdTitle SET Table1.StockLev = [Table2]![Count Of Table1];
About the Calculation...your evaluation is correct but it is not good
practice to stor calculations. Calculations can be displayed in form,
reports and queries as you have described. Use the Builder option in the
Query tool to properly build the formula.


Thankyou! It turns out that I need many tables (i thought through the
assignment and found it was a crap specification). What i was trying to do
wasn't with queries, buti see now that that is the only way to add the full
functionality that was required. (teacher wanted a one table database with
customers, dvds, allsorts on the same thing - how stupid?)
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003
Nov 12 '05 #3
TC

I suggest you read:

http://support.microsoft.com/support...es/Q100139.ASP

HTH,
TC

steveee <sm******************************@ve.com.invalid > wrote in message
news:Th******************@newsfep4-glfd.server.ntli.net...
Hi!

I'm building a db in access for a school project, and was wondering how to
make the value for a field the same as the number of records with the same
value in another field.
e.g.
DvdTitle = Pulp fiction
StockLev = 1

DvdTitle = Finding Nemo
StockLev = 2

DvdTitle = Finding Nemo
StockLev = 2
etc.

also (you can tell how little I've used access now...) how to say a currency value(the price of each dvd)*a numeric value (the stock level) in the field StockCost. I presume it is just "=Price*StockLev" in default value field.

Thankyou very much (in advance)
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003

Nov 12 '05 #4

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

Similar topics

19
by: Leif K-Brooks | last post by:
Has anyone ever tried implementing a simple unstructured BASIC dialect in Python? I'm getting interested in language implementation, and looking at a reasonably simple example like that could be...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
54
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3...
56
by: Dave Vandervies | last post by:
I just fixed a bug that some of the correctness pedants around here may find useful as ammunition. The problem was that some code would, very occasionally, die with a segmentation violation...
14
by: luis | last post by:
Are basic types (int, long, ...) objetcs or not? I read that in C# all are objects including basic types, derived from Object class. Then in msdn documentation says that boxing converts basic...
4
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
14
by: MartinRinehart | last post by:
Working on parser for my language, I see that all classes (Token, Production, Statement, ...) have one thing in common. They all maintain start and stop positions in the source text. So it seems...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...

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.