473,385 Members | 1,712 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.

expression problems

I want to enter an expression into my Default Value under my field
properties
within the design view of my table.

In English:

If the previous record has the same "product ID" number then by default
make the result FALSE, otherwise TRUE for the given field name value.

What this does is compare the previous Product ID (data type is Number) -
foreign key
to the Product Table ID (data type is AutoNumber) of the previous record.

Thus if the Product ID is the same number for the previous record "Product
Table ID minus 1"
of Product ID, then this means that our Product ID is not the first new
record entered.

Problem:

The Field Names are made up of multiple text so how can I enter an
expression
and also subtract 1 from the value the field name represents ?

The following didn't work:

If [Product Table ID -1] = [Product ID] Then False

Please help me write the expression for the default value.

Thanks,
Martians
Nov 12 '05 #1
1 1413
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why are you trying to do this? Try expressions like "I want to limit
the number of ...," "There can only be ...," "I want the user to
know ...," etc.

In SQL tables there isn't any order to records; therefore "previous
record" has no meaning (unless you're looking at a recordset in a
datasheet or form). If you want to prevent duplicate ProductIDs being
entered you can set the ProductID column as the Primary Key (or a
unique index) - or a combination of columns as PK or unique index.

Example: You have an order system. You do not want to allow
customers to order more than 1 product per order:

Orders table
CustomerID
OrderID
OrderDate
SalesRep
... etc. ...

Order Details table
OrderID
ProductID
Quantity - you could restrict this value to 1

OR - you could have a PK on the OrderID and ProductID without the
Quantity column, which would mean that there could only be one product
(ProductID) per order (OrderID).

If you used the Quantity column you could have a Check Constraint
(Validation Rule in .mdb tables) that could make sure the value is
within a specified range, e.g.:

Between 1 and 4

This would only allow 4 items to be requested in one order.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQB2rGIechKqOuFEgEQIKQwCgm86tpYyGIduKqm37d/++qROUxFEAn0qj
ozYTgLumJ3oG/S0jPBGaSNng
=gZo/
-----END PGP SIGNATURE-----
Earthling wrote:
I want to enter an expression into my Default Value under my field
properties
within the design view of my table.

In English:

If the previous record has the same "product ID" number then by default
make the result FALSE, otherwise TRUE for the given field name value.


Nov 12 '05 #2

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

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Saira | last post by:
Hello al I am not sure where to post this, so I hope this is correct. We have written a Visual Studio AddIn that relies heavily on regular expressions, which are often executed...
1
by: Tooled | last post by:
I am writing a vb.net app that uses ms-access as its database. I need to allow users to create their own custom sql expressions that will eventually be used in their reports. After they have...
4
by: Frank Wallingford | last post by:
Note: For those with instant reactions, this is NOT the common "why is i = i++ not defined?" question. Please read on. I came across an interesting question when talking with my colleagues....
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
3
by: Sagaert Johan | last post by:
Hi This is not all so clear to me, as i understand i can create feature rich UI's with it . How does it combine with Visual Studio 2005 to create windows applications ? How to use content...
1
by: Shawn B. | last post by:
Greetings, I'm using a custom WebBrowser control: http://www.codeproject.com/KB/miscctrl/csEXWB.aspx When I get the DocumentSource of a web page I browsed, and run a regular expression...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.