how to insert record into table one by one

K

Krishnakanth

Let me explain with an example
I am having a table in ms access
table : salary_details

name ssn join_date yearly_salary
-------------------------------------------------------------------------
kevin 111223333 01/01/2008 2000
linda 555447777 01/02/2008 1800
-------------------------------------------------------------------------
I am having 2 rows in the above table consists of fields as follows.
name,
ssn,
join_date,
yearly_salary

Now I am having another table table called monthly_details consists of
fields as follows.
name,
ssn,
year,
month,
monthly_salary

I am having a form. Form_month.
I am having a two combo boxes as follows.
combo1 : year,
combo2 : month,
command1 : OK <button>

The user has to select the year and month and will click OK button.
Now for every name the monthly_salary has to be calculated as follows.
monthly_salary = yearly_salary/12,
year = current year,
month = current month

After calculated the above fields,
name, ssn, year, month, monthly_salary will have to inserted to the table
monthly_details.

The same operation has to be perform for the every record in the table
salary_details.

that is every record from salary_details has to be read one by one and
perform some calculation and it has to be inserted in the table
monthly_details.

note : all the table, forms,queries everything is in ms access. there is no
foreign object involve in this.
I am using MS ACCESS 2000. Moreover I know that monthly_salary will be
calculated thru query. But i dont want that. Here I have to perform similar
task to the above.(this is just an example)

Could you please help me how to do this in ms access.

Krishnakanth VM
Software Engineer
 
M

MichaelRay via AccessMonster.com

You could create a query that's used to append to the monthly_details table.
It would have calculated fields for monthy salary, etc.

It would look something like this:

Select name, ssn, yearly_salary/12 as 'monthly_salary', Year(Now()) as 'Year',
Month(Now()) as Month from salary_details....etc. (using a where clause).

I'm a little confused by the combo box. You say the user selects a year and
month from the combo box, but you want to use current month and current year
which would be the Year(Now()) and Month(Now()) above. You could always
create functions ChosenYear() and ChosenMonth() which return the combo box
values of Year and Month the user has selected, if that's what you want to do,
and include them in the query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top