By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

Copy data into another table

P: n/a
Hi:
Can any one please help me when user select 2 dates from DDLDate1
10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I
need to create multiple records in the another table on the basis of
two dates like that.

Data in continous form table1
-----------------------------
Data entered in continous form
10/09/2006 10/12/2006 John
10/12/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

Required data into table table2
10/09/2006 10/09/06 John
10/10/06 10/10/06 John
10/11/06 10/11/06 John
10/12/06 10/12/06 John
10/13/06 10/13/06 John
10/12/2006 10/12/2006 Petty
10/13/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

I am currently using a continuous form where there are two drop downs
one for AppDate and other for EndDate. I need a script here once use
close the form, Script check the data and create multiple records on
the basis of date selection into table2. I am using two tables. One for
the continous form and the other for the reports (Both have same
fields). Continous form table i empty it every time once it close. So i
need the result into another table assume form table name is table1 and
table where i need multiple records name is table2.

Thanks.

Oct 5 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You could:

Assuming table2 is filled from form controls
Assuming fields of StartDate, EndDate, Name in table2
'Pass the values of your fields to a procedure like this.

Sub FillTable2(dtStart, dtEnd, strName)
Dim DB As database
Dim rs2 As Recordset
Dim dtMark As Date
Set DB = CurrentDb
Set rs2 = DB.openrecordset("Students", dbopendynaset)
rs2.MoveLast
For stMark = dtStart To dtEnd
rs2.AddNew
rs2.StartDate = dtMark
rs2.EndDate = dtMark
rs2.Name = strName
rs2.Update
Next
End Sub

I wonder though if there isn't some way to do this with a query.
PS Why do you want to store a date twice?

<co*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi:
Can any one please help me when user select 2 dates from DDLDate1
10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I
need to create multiple records in the another table on the basis of
two dates like that.

Data in continous form table1
-----------------------------
Data entered in continous form
10/09/2006 10/12/2006 John
10/12/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

Required data into table table2
10/09/2006 10/09/06 John
10/10/06 10/10/06 John
10/11/06 10/11/06 John
10/12/06 10/12/06 John
10/13/06 10/13/06 John
10/12/2006 10/12/2006 Petty
10/13/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

I am currently using a continuous form where there are two drop downs
one for AppDate and other for EndDate. I need a script here once use
close the form, Script check the data and create multiple records on
the basis of date selection into table2. I am using two tables. One for
the continous form and the other for the reports (Both have same
fields). Continous form table i empty it every time once it close. So i
need the result into another table assume form table name is table1 and
table where i need multiple records name is table2.

Thanks.

Oct 5 '06 #2

P: n/a
The first assumption is that table1 NOT table2 is filled from form.
"Kc-Mass" <co********@comcast.netwrote in message
news:Vv******************************@comcast.com. ..
You could:

Assuming table2 is filled from form controls
Assuming fields of StartDate, EndDate, Name in table2
'Pass the values of your fields to a procedure like this.

Sub FillTable2(dtStart, dtEnd, strName)
Dim DB As database
Dim rs2 As Recordset
Dim dtMark As Date
Set DB = CurrentDb
Set rs2 = DB.openrecordset("Students", dbopendynaset)
rs2.MoveLast
For stMark = dtStart To dtEnd
rs2.AddNew
rs2.StartDate = dtMark
rs2.EndDate = dtMark
rs2.Name = strName
rs2.Update
Next
End Sub

I wonder though if there isn't some way to do this with a query.
PS Why do you want to store a date twice?

<co*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>Hi:
Can any one please help me when user select 2 dates from DDLDate1
10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I
need to create multiple records in the another table on the basis of
two dates like that.

Data in continous form table1
-----------------------------
Data entered in continous form
10/09/2006 10/12/2006 John
10/12/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

Required data into table table2
10/09/2006 10/09/06 John
10/10/06 10/10/06 John
10/11/06 10/11/06 John
10/12/06 10/12/06 John
10/13/06 10/13/06 John
10/12/2006 10/12/2006 Petty
10/13/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

I am currently using a continuous form where there are two drop downs
one for AppDate and other for EndDate. I need a script here once use
close the form, Script check the data and create multiple records on
the basis of date selection into table2. I am using two tables. One for
the continous form and the other for the reports (Both have same
fields). Continous form table i empty it every time once it close. So i
need the result into another table assume form table name is table1 and
table where i need multiple records name is table2.

Thanks.


Oct 5 '06 #3

P: n/a
Correction 2 - The refrence to pass the "value of your fields" should
obviously be pass the "value of your form controls".
Sorry - That was a long night
"Kc-Mass" <co********@comcast.netwrote in message
news:p8******************************@comcast.com. ..
The first assumption is that table1 NOT table2 is filled from form.
"Kc-Mass" <co********@comcast.netwrote in message
news:Vv******************************@comcast.com. ..
>You could:

Assuming table2 is filled from form controls
Assuming fields of StartDate, EndDate, Name in table2
'Pass the values of your fields to a procedure like this.

Sub FillTable2(dtStart, dtEnd, strName)
Dim DB As database
Dim rs2 As Recordset
Dim dtMark As Date
Set DB = CurrentDb
Set rs2 = DB.openrecordset("Students", dbopendynaset)
rs2.MoveLast
For stMark = dtStart To dtEnd
rs2.AddNew
rs2.StartDate = dtMark
rs2.EndDate = dtMark
rs2.Name = strName
rs2.Update
Next
End Sub

I wonder though if there isn't some way to do this with a query.
PS Why do you want to store a date twice?

<co*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googleg roups.com...
>>Hi:
Can any one please help me when user select 2 dates from DDLDate1
10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I
need to create multiple records in the another table on the basis of
two dates like that.

Data in continous form table1
-----------------------------
Data entered in continous form
10/09/2006 10/12/2006 John
10/12/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

Required data into table table2
10/09/2006 10/09/06 John
10/10/06 10/10/06 John
10/11/06 10/11/06 John
10/12/06 10/12/06 John
10/13/06 10/13/06 John
10/12/2006 10/12/2006 Petty
10/13/2006 10/13/2006 Petty
11/11/2006 11/11/2006 Stiffny

I am currently using a continuous form where there are two drop downs
one for AppDate and other for EndDate. I need a script here once use
close the form, Script check the data and create multiple records on
the basis of date selection into table2. I am using two tables. One for
the continous form and the other for the reports (Both have same
fields). Continous form table i empty it every time once it close. So i
need the result into another table assume form table name is table1 and
table where i need multiple records name is table2.

Thanks.



Oct 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.