View Full Version : Looking up label values on a form


velcrowe
02-07-2008, 11:06 AM
I am using the following code in the open event to set the gloves label on my form frm_Delivery_2 equal to the gloves label on form frm_delivery_1. I receive the error that the form frm_delivery_1 cannot be found. When I set the gloves label equal to another label or frm_delivery_2 using the same synax it works.

Private Sub Form_Open(Cancel As Integer)
Me.Gloves_Label.Caption = Forms!frm_Delivery_1.Gloves_Label.Caption
End Sub

What or where would I need to setup the code so that it sees the glove_label value on my form frm_delivery_1 and sets the glove label on my frm_delivery_2 equal to it.

pbaldy
02-07-2008, 11:43 AM
Is that form open when this code runs? It would have to be.

velcrowe
02-07-2008, 12:13 PM
No. Is there anyway to change the label(s) values on the 1st form and when I open the 2nd form the changes are updated based upon those values. I am trying to make the changes universal. I don't want the users of the 2nd form to update anything except for their order quantities. Is there somewhere else I could place the code to do so or maybe run a macro?

pbaldy
02-07-2008, 12:29 PM
If there's a form that's always open, you could store them there (they can be hidden). You could also use a global variable in VBA (a variable declared in a standard module rather than a form/report module).