Home » Developer & Programmer » Forms » insert values into table from non-db items??help?
insert values into table from non-db items??help? [message #126317] Sun, 03 July 2005 05:41 Go to next message
ramisy2k
Messages: 150
Registered: April 2005
Senior Member

Hi,

I am facing a huge problem. I would appreciate if someone helps me.

I have a form in which there some database items and non-database items. The values in database items are being saved by entering directly from the form.

But the problem is with the values in the non-database items that are not being entered but are automatically calculated at run-time. For some purpose I want to

save/delete/insert or update the values from two dtabse items and two non-database items to another database table. The Form shows 10 to 14 records at a time.

Suppose the first two database items in my form..are

ITEM_1, ITEM_2

(ITEM_1 is the primary key)

and remianing two non-db items are
ITEM_3, ITEM_4

ALL THESE HAVE NUMBER DATATYPES

Suppose there is table t in which i want to save the values of these four items..

the table has only four columns MATCH_ID, TEAM_ID, SERIAL_NO, PLAYER_ID

Create table t (MATCH_ID number,
TEAM_ID number,
SERIAL_NO number,
PLAYER_ID number)

The four columns above are jointly primary key which means that they cannot be

repeated combined..

IT SHOULD BE NOTED THAT
ITEM_1 = MATCH_ID
ITEM_2 = TEAM_ID
ITEM_3 = SERIAL_NO
ITEM_4 = PLAYER_ID


Now suppose in the form I have 5 records showing up with the following values in

the items

ITEM_1      ITEM_2    ITEM_3     ITEM_4
1               1         1         1
1               2         9         98
2               3         11        40
3               5         6         100
5               4         2         14


Now I want that these values should be inserted into the database in the following 

format on the press of a button

MATCH_ID     TEAM_ID      SERIAL_NO       PLAYER_ID
1                   1       1                    1
1                   2       9                    98
2                   3       11                   40
3                   5       6                    100
5                   4       2                    14

also I want that If any of values of the four items is changed at run time then in the databse the respective value ahould also be updated

Suppose for first record I change the value of Item_4 from player_id = 1 to player_id 

= 55

then the table should automatically be updated on the press of a button

MATCH_ID     TEAM_ID      SERIAL_NO      PLAYER_ID
1                   1          1            55
1                   2          9            98
2                   3          11           40


Also if 

Item_4 is null or 0 on the form then nothing should be saved in the database for the same record.

Also if Item_4 is updated to null then the record should be removed from the table..
for exmaple

if at present the values in four items for 5 records are 

ITEM_1      ITEM_2    ITEM_3      ITEM_4
1               1        1          1
1               2        9          98
2               3        11         40
3               5        6          100
5               4        2          14

and table has also 

MATCH_ID     TEAM_ID      SERIAL_NO      PLAYER_ID
1               1               1           1
1               2               9           98
2               3               11          40
3               5               6           100
5               4               2           14

then if the value of the ITEM_4 FOR THE LAST RECORD IS SET TO NULL THEN THIS 

RECORD SHOULD BE removed from the table

i.e on form

ITEM_1      ITEM_2    ITEM_3      ITEM_4
1               1        1           1
1               2        9           98
2               3        11          40
3               5        6           100
5               4        2               


i.e. the last record is removed form the table

MATCH_ID     TEAM_ID      SERIAL_NO      PLAYER_ID
1                   1         1            1
1                   2         9            98
2                   3         11           40
3                   5         6            100



I hope this will clear my requirement. I would be extremely grateful if some one can write a cursor/procedure to manage this type of problem...


regards,
Asim.
Re: insert values into table from non-db items??help? [message #126624 is a reply to message #126317] Wed, 06 July 2005 00:49 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Asim,

Have you worked out a solution to your problem?

David
Previous Topic: check boxes and multi record block
Next Topic: what is the difference bet pre query and post query
Goto Forum:
  


Current Time: Thu Sep 19 23:07:22 CDT 2024