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

please help to create a table with relationships

I create a table in MS access:

CREATE TABLE TABLE1
(_ID COUNTER PRIMARY KEY,
SESSION_ID INTEGER REFERENCES SESSIONS (SESSION_ID),
FIELD1 INTEGER,
FIELD2 INTEGER,
);

session_id is linked to same named filed in tabble SESSIONS. this
query works ok, but I need cascade deletion of related records. what I
need add to this query?
Nov 13 '05 #1
2 1269
"Alex Boborikin" <in******@online.sinor.ru> wrote in message
news:c3**************************@posting.google.c om...
I create a table in MS access:

CREATE TABLE TABLE1
(_ID COUNTER PRIMARY KEY,
SESSION_ID INTEGER REFERENCES SESSIONS (SESSION_ID),
FIELD1 INTEGER,
FIELD2 INTEGER,
);

session_id is linked to same named filed in tabble SESSIONS. this
query works ok, but I need cascade deletion of related records. what I
need add to this query?


CREATE TABLE TABLE1
(_ID COUNTER PRIMARY KEY,
SESSION_ID INTEGER REFERENCES SESSIONS (SESSION_ID)
ON DELETE CASCADE,
FIELD1 INTEGER,
FIELD2 INTEGER,
);
Nov 13 '05 #2
in******@online.sinor.ru (Alex Boborikin) wrote in message news:<c3**************************@posting.google. com>...
I create a table in MS access:

CREATE TABLE TABLE1
(_ID COUNTER PRIMARY KEY,
SESSION_ID INTEGER REFERENCES SESSIONS (SESSION_ID),
FIELD1 INTEGER,
FIELD2 INTEGER,
);

session_id is linked to same named filed in tabble SESSIONS. this
query works ok, but I need cascade deletion of related records. what I
need add to this query?


You have to do this in DAO
Set rel = db.CreateRelation("NameOfRelation", "SESSIONS",
"TABLE1", dbRelationDeleteCascade)

rel.Fields.Append rel.CreateField("SESSION_ID")
rel.Fields("CASENBR").ForeignName = "SESSION_ID"

db.Relations.Append rel
Nov 13 '05 #3

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

Similar topics

4
by: Dave | last post by:
I am working on an access 2000 DB for some tree-growers that will be storing items in a heirarchy of locations. The items will obviously be stored at the lowest level in the heirarchy (in a row)...
18
by: Jeremy Weiss | last post by:
I'm trying to build a database that will handle the monthly billing needs of a small company. I'm charting everything out and here's what I see: table for customers sub table to track payments...
7
by: sea | last post by:
Is it a good idea to programatically create a primary key? For example in a table called names, I have the following fields, (1) firstname (2)lastname (3) ID - will it be ok to create a primary...
14
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
2
by: Mindy | last post by:
Hey, I want to create links between my two tables. The primary keys of these two tables are character variables, with length =11. I followed exactly the instruction of Dummuy Book for ACCESS...
3
by: teedilo | last post by:
Our MS SQL (SQL Server 2000) DBA has database privileges locked down pretty tightly. We end users/developers do not have administrator privileges for most databases. That arrangement has worked...
1
by: Mark | last post by:
Hi there gurus, can you please add your 2 cents on this design? We're having trouble relating these tables in a diagram because of the keys. Is it necesary to have the references setup? I would...
0
by: Shootah | last post by:
Hi, I have succeeded in adding automated relationships with refference tables after importing an excel file created from a query to an Access database. However I have the following problem: ...
3
by: anjee | last post by:
Hello, Is it possible to create multiple foreign keys on a field in a table from values in two separate tables where the field value can be from one table OR the other? For example, I have an...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.