Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving data from one form to another 1

Status
Not open for further replies.

liwan

Technical User
Aug 10, 2003
22
0
0
AU
Dear Ppl,
I am currently using Access 97.I want to transfer data(a few attributes) from Form A to Form B which have the same attribute name. I wanted it to be automated, when I finish inserting details on Form A, I'll have a command button to goto Form B ,thus,I want Form B with the same field as Form A automatically to be filled.
Please help!!
Regards,
liwan
 
liwan,

are they really different forms or the same form with different data. In other words, do you close one form and open another?

Rollie E
 
Dear Rolliee,

SO glad somebody answered!! Is a different form. E.g: Form A have 10 fields,and 4 of them are the same with Form B's fields. When I finish entering data in FormA , I'll click on a command button in FormA to open Form B.I would like the 4 fields to be filled when it is open.
Thanks in advance!!

Regards,
liwan
 
Dear dzepeda,

I tried using the code butthe compile error : Method or data not found in Form B. Whereas Form A say variable not defined.I am wondering what do I defined it AS () I tried textbox and fields but it say for intrinsic use only.Btw, I am using Access97.Please advise, thanks.

Regards,
Amanda

 
liwan,


To open the new form there is a command in the underlying code that says this:

DoCmd.openform "frmName2"


In front of that code put

DIM var1 ,var2,var3,var4 as variant

var1 = me.somefield1
var2 = me.somefiels2
var3 =.....
var4 = .....

After that DoCmd code put:

me.somefield5 = var1
me.somefield6 = var2
ditto
ditto

You must of course use your form and variable names.

Rollie E

 
I used a similar piece of code for transferring details of people from one form to another.... here goes :)

'First open the form
DoCmd.OpenForm "form2"

'Now the form is opened, put in variables!
Forms![form2]![value1] = Forms[form1]![value1]
Forms![form2]![value2] = Forms[form1]![value2]
Forms![form2]![value3] = Forms[form1]![value3]
Forms![form2]![value4] = Forms[form1]![value4]
Forms![form2]![value5] = Forms[form1]![value5]

Should work fine :)

David
 
Hey guys!!

It works perfectly the way I wanted it thankS you so much. Thank to you David & Rollie!! I have another thread which is unanswered at all. Any idea on that! How do I putmy selected contacts from the form to a word document?

Regards,
liwan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top