473,473 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to insert record into one to one relationship table

Hi all

I created two tables - Employee and Folder using MS Access 2002.

Inside Employee table, I got 3 fields:

EmployeeID (Data Type:Autonumber) [primary key]
Username (Data Type: Text)
Password (Data Type: Text)

Inside Folder table, I got 3 fields

FolderID (Data Type: Autonumber) [primary key]
FolderName (Data Type: Text)
EmployeeID (Data Type: Number - Long Integer) [foreign key]

My situation is: After the user login successfully, i will save his
username into session variable. Then, they can select a folder from
the drop down box. After he press the "Add Folder" button. The name of
that folder will be add it into Folder table FolderName field. For
example:

EmployeeID Username Password
10 admin admin
11 somebody pwd

FolderID FolderName EmployeeID
1 Temp 10
2 somebody 11

Can anybody tell me how can I write the SQL for doing it?

Thank you.
Nov 13 '05 #1
1 6295
"tabonni" <ta*****@yahoo.com> wrote in message
news:fb**************************@posting.google.c om...
Hi all

I created two tables - Employee and Folder using MS Access 2002.

Inside Employee table, I got 3 fields:

EmployeeID (Data Type:Autonumber) [primary key]
Username (Data Type: Text)
Password (Data Type: Text)

Inside Folder table, I got 3 fields

FolderID (Data Type: Autonumber) [primary key]
FolderName (Data Type: Text)
EmployeeID (Data Type: Number - Long Integer) [foreign key]

My situation is: After the user login successfully, i will save his
username into session variable. Then, they can select a folder from
the drop down box. After he press the "Add Folder" button. The name of
that folder will be add it into Folder table FolderName field. For
example:

EmployeeID Username Password
10 admin admin
11 somebody pwd

FolderID FolderName EmployeeID
1 Temp 10
2 somebody 11

Can anybody tell me how can I write the SQL for doing it?

Thank you.


Something doesn't make sense here. Your table design implies a one-to-many
relationship between employee and folder i.e. one employee can have many
folders, but a folder has one and only one employee. But, you have
indicated that you intend to have a drop-down list of folders. This implies
either a one-to-many relationship between folders and employees (so FolderId
would need to be a foreign key on the Employee table), or a many-to-many
relationship between folders and employees (so you would need an additional
junction table with both FolderId and EmployeeId as foreign keys).

Whatever it is you want, you should be able to achieve it using bound forms
without explicitly writing any SQL, but you will need to rationalise your
design first.
Nov 13 '05 #2

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

Similar topics

14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
8
by: Bri | last post by:
Greetings, I'm having a very strange problem in an AC97 MDB with ODBC Linked tables to SQL Server 7. The table has an Identity field and a Timestamp field. The problem is that when a new record...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
5
by: djsdaddy | last post by:
Good Day All, I have some EEO data in an old dBase4 database that I have converted to an Access table. Since dBase was not a relational database, I didn't create any key fields. I linked all of the...
4
by: PW | last post by:
Hi, I set up a relationship between two tables with the itineraryid fields in both tables: tblDailyItinerary tblDailyMeals I have a form that writes a record to tblDailyItinerary that...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
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...
0
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 ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.