fill in record from previous form with button

A

Ann

I have a form where you enter billing info. On this form there is a command
button that closes it and opens a form to enter inventory. Some info entered
in the inventory form will be the same as what was entered on the billing
form. Is there a way you can have that data updated to the inventory form
when it is opened?

Thanks
 
O

Ofer

Hi Ann

There are few ways that you can use
1. Create few global variable, in a module, Before you close the first form
save the fields value in the variables
Variable1=Me.Field1
Variable2=Me.Field2

On the Load event of the second form, you can assign the variables values to
the fields in the second form
Me.Field1=Variable1
Me.Field2=Variable2

2. Use The OpenArgs to pass values to the second form
docmd.OpenForm "FormName",,,,,,Me.Field1 & "-" & Me.Field2

Where each field is seperated by a dash, or any thing you like

On the Load event of the second form, aplit the OpenArgs to get the values
and assign them to the fields
Me.Field1=Split(Me.OpenArgs,"-")(0)
Me.Field2=Split(Me.OpenArgs,"-")(1)
 
A

Ann

Thanks. I'll try it and let you know.


Ofer said:
Hi Ann

There are few ways that you can use
1. Create few global variable, in a module, Before you close the first form
save the fields value in the variables
Variable1=Me.Field1
Variable2=Me.Field2

On the Load event of the second form, you can assign the variables values to
the fields in the second form
Me.Field1=Variable1
Me.Field2=Variable2

2. Use The OpenArgs to pass values to the second form
docmd.OpenForm "FormName",,,,,,Me.Field1 & "-" & Me.Field2

Where each field is seperated by a dash, or any thing you like

On the Load event of the second form, aplit the OpenArgs to get the values
and assign them to the fields
Me.Field1=Split(Me.OpenArgs,"-")(0)
Me.Field2=Split(Me.OpenArgs,"-")(1)
 
O

Ofer

You are very welcome :)
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck
 
Top