Copy some parts of records ... delete and transfer to another record

  • Thread starter Thread starter Beatrix J B
  • Start date Start date
B

Beatrix J B

Hi!

I would like to make a button on my form when clicked would do the following
in order

1. Select some fields in the record to be specified of course
2 put it contents and save it temporarily in a variables
3. open a form and paste the fileds based on these varables

Its like I want ti transfer these values progmatically to another form and
delete them after transferring

Thanks.
 
Hi

From what you're describing, there is no need for 'temporary variables'. You
can just associate them directly from form to form. Lets assume you want to
copy some info in Form1 to Form2, Both forms have 2 fields, Field1 and Field2.

In you Command Button click event use the following:

Dim MyForm as String
MyForm = "Form2"
Docmd.openform MyForm

Forms![Form2]![Field1] = Forms![Form1]![Field1]
Forms![Form2]![Field2] = Forms![Form1]![Field2]

Hope this is what you're after.
 
Looks feasible ... after this how do i then make a command referring to the
old record in the 1st open form and have it deleted

Vantastic said:
Hi

From what you're describing, there is no need for 'temporary variables'.
You
can just associate them directly from form to form. Lets assume you want
to
copy some info in Form1 to Form2, Both forms have 2 fields, Field1 and
Field2.

In you Command Button click event use the following:

Dim MyForm as String
MyForm = "Form2"
Docmd.openform MyForm

Forms![Form2]![Field1] = Forms![Form1]![Field1]
Forms![Form2]![Field2] = Forms![Form1]![Field2]

Hope this is what you're after.


Beatrix J B said:
Hi!

I would like to make a button on my form when clicked would do the
following
in order

1. Select some fields in the record to be specified of course
2 put it contents and save it temporarily in a variables
3. open a form and paste the fileds based on these varables

Its like I want ti transfer these values progmatically to another form
and
delete them after transferring

Thanks.
 
Do you want to delete the record or just empty the fields?

If its the latter, just have a button with the following code

Forms![Form1]!Field1 = ""

If the former:

Forms![Form1]!Field1.Setfocus
RunCommand acCmdDeleteRecord

Cheers

Beatrix J B said:
Looks feasible ... after this how do i then make a command referring to the
old record in the 1st open form and have it deleted

Vantastic said:
Hi

From what you're describing, there is no need for 'temporary variables'.
You
can just associate them directly from form to form. Lets assume you want
to
copy some info in Form1 to Form2, Both forms have 2 fields, Field1 and
Field2.

In you Command Button click event use the following:

Dim MyForm as String
MyForm = "Form2"
Docmd.openform MyForm

Forms![Form2]![Field1] = Forms![Form1]![Field1]
Forms![Form2]![Field2] = Forms![Form1]![Field2]

Hope this is what you're after.


Beatrix J B said:
Hi!

I would like to make a button on my form when clicked would do the
following
in order

1. Select some fields in the record to be specified of course
2 put it contents and save it temporarily in a variables
3. open a form and paste the fileds based on these varables

Its like I want ti transfer these values progmatically to another form
and
delete them after transferring

Thanks.
 
Thanks .... most probably delete the whole record ..... perhaps if I learn
more in the long run ..... i was thinking of click to select in one pane and
transfer all selected records to the other tble ...

Thanks again! :-)
Vantastic said:
Do you want to delete the record or just empty the fields?

If its the latter, just have a button with the following code

Forms![Form1]!Field1 = ""

If the former:

Forms![Form1]!Field1.Setfocus
RunCommand acCmdDeleteRecord

Cheers

Beatrix J B said:
Looks feasible ... after this how do i then make a command referring to
the
old record in the 1st open form and have it deleted

Vantastic said:
Hi

From what you're describing, there is no need for 'temporary
variables'.
You
can just associate them directly from form to form. Lets assume you
want
to
copy some info in Form1 to Form2, Both forms have 2 fields, Field1 and
Field2.

In you Command Button click event use the following:

Dim MyForm as String
MyForm = "Form2"
Docmd.openform MyForm

Forms![Form2]![Field1] = Forms![Form1]![Field1]
Forms![Form2]![Field2] = Forms![Form1]![Field2]

Hope this is what you're after.


:

Hi!

I would like to make a button on my form when clicked would do the
following
in order

1. Select some fields in the record to be specified of course
2 put it contents and save it temporarily in a variables
3. open a form and paste the fileds based on these varables

Its like I want ti transfer these values progmatically to another form
and
delete them after transferring

Thanks.
 
Hi!

I would like to make a button on my form when clicked would do the following
in order

1. Select some fields in the record to be specified of course
2 put it contents and save it temporarily in a variables
3. open a form and paste the fileds based on these varables

Its like I want ti transfer these values progmatically to another form and
delete them after transferring

Thanks.

I'd REALLY REALLY suggest that you step back and reconsider your
entire table design.

The need to do this suggests that you have two or more tables in which
you are storing the same kind of information, and need to move the
data from table to table. (Do note that data is NOT stored in forms,
forms are just windows onto the data stored in Tables).

Storing the same information in multiple tables is Bad Design. The
whole point of a relational database is that you can store the
information ONCE, and use queries to link to it as needed! Moving data
around from table to table is very, very rarely necessary in a
properly normalized database.

John W. Vinson[MVP]
 

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

Back
Top