Can you link the value of a cell from one form to another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
Is it possible to link a value in a cell in one form to another? Like Excel
where a vakue in a cell on sheet 2 can be linked to a cell in sheet 1.

What I am trying to do is take the sales quantity on an invoice(form) to
deduct from the Stock on hand cell in the stock form

thanks

Leopard
 
Its a long answer for a short question.
First you can do it, but only if the stock form running.
You can have a reference to every field in a form from another form that is
running
If the field on the main form
Forms![stock form name]![sales quantity field name]

If the field on the sub form
Forms![stock form name]![SubFormName].form![sales quantity field name]

Now the question is are you going to save this value in the invoice form, or
not.
If you just want to display the value, then you can create a field in the
invoice form, in the ControlSource Property of the field you can write
=Forms![stock form name]![sales quantity field name]

If you want to save the value, then using VBA you can write in the invoice
form
me.[sales quantity]=Forms![stock form name]![sales quantity field name]

We missing information about what you want to do, so I hope that the above
helped.
 
leopard,

First, Access does not have cells. An Access form has controls. The most
common for accepting and displaying data is the text box. Now, to answer
your question. The answer is sort of yes. You can't "link" them so that one
alway picks up the vaule from the other. You have to use VBA in Events to
accomplish the desired result. For example, lets say you want text box 2
(txt2) to have the same value as text box 1 (txt1). What you have to do is
in the After Update event of txt1 give txt2 the same vaule:

Me.txt2 = Me.txt1
 
Hi Ofer

Sorry for the delay but I have been out of the office.

When you say the stock form needs to be running, are you saying that the
other form is a subform of the stock form? If not how do you run one form
while working in another?

Thanks

Leopard

Ofer said:
Its a long answer for a short question.
First you can do it, but only if the stock form running.
You can have a reference to every field in a form from another form that is
running
If the field on the main form
Forms![stock form name]![sales quantity field name]

If the field on the sub form
Forms![stock form name]![SubFormName].form![sales quantity field name]

Now the question is are you going to save this value in the invoice form, or
not.
If you just want to display the value, then you can create a field in the
invoice form, in the ControlSource Property of the field you can write
=Forms![stock form name]![sales quantity field name]

If you want to save the value, then using VBA you can write in the invoice
form
me.[sales quantity]=Forms![stock form name]![sales quantity field name]

We missing information about what you want to do, so I hope that the above
helped.



leopard said:
Hi
Is it possible to link a value in a cell in one form to another? Like Excel
where a vakue in a cell on sheet 2 can be linked to a cell in sheet 1.

What I am trying to do is take the sales quantity on an invoice(form) to
deduct from the Stock on hand cell in the stock form

thanks

Leopard
 
No it doesn't need to be a sub form, but both forms need to be open.
You can open as many forms that you would like at the same time, to retrieve
a value from a form, just write the code
Forms![FormName]![FieldName]

If you dont want to open both forms, but you still need the data from
another table, then retrieve the data strait from the table rather then from
the form.
For that use the dlookup.
DlookUp("FieldName","TableName","Filter") ' Read the help about that


leopard said:
Hi Ofer

Sorry for the delay but I have been out of the office.

When you say the stock form needs to be running, are you saying that the
other form is a subform of the stock form? If not how do you run one form
while working in another?

Thanks

Leopard

Ofer said:
Its a long answer for a short question.
First you can do it, but only if the stock form running.
You can have a reference to every field in a form from another form that is
running
If the field on the main form
Forms![stock form name]![sales quantity field name]

If the field on the sub form
Forms![stock form name]![SubFormName].form![sales quantity field name]

Now the question is are you going to save this value in the invoice form, or
not.
If you just want to display the value, then you can create a field in the
invoice form, in the ControlSource Property of the field you can write
=Forms![stock form name]![sales quantity field name]

If you want to save the value, then using VBA you can write in the invoice
form
me.[sales quantity]=Forms![stock form name]![sales quantity field name]

We missing information about what you want to do, so I hope that the above
helped.



leopard said:
Hi
Is it possible to link a value in a cell in one form to another? Like Excel
where a vakue in a cell on sheet 2 can be linked to a cell in sheet 1.

What I am trying to do is take the sales quantity on an invoice(form) to
deduct from the Stock on hand cell in the stock form

thanks

Leopard
 
Back
Top