Passing information from one form to another (1 Viewer)

ccondran08

Registered User.
Local time
Tomorrow, 03:40
Joined
Feb 27, 2014
Messages
58
Hi, I have a problem whereby I have created Form1 with a button and after I click the button Form2 appears (frm_Rollover_Progress). Form2 is a (poor man’s) progress indicator that makes some labels visible after a section of a query has run. I have set the first label on the form to ‘Me.lblProgress1.Visible = True’ but I keep coming up with ‘Compile Error - Method or data member not found’. However, when I put a button on the second form and copy in the exact same code then ‘Me.Label1.Visible = True’ works. I have tried to SetFocus to an item on Form2 but still does not work. Below is part of the code. Does anyone have any suggestions?


'Open progress form to show progress indicator
DoCmd.OpenForm "frm_Rollover_Progress", acNormal, , , acFormReadOnly

'Add current changes to Total Changes table

Me.lblProgress1.Visible = True
Me.Label1.Caption = "10%"

DoCmd.OpenQuery "qry_Change_AddedQX2", acViewNormal, acAdd
Me.lblProgress2.Visible = True
Me.lblProgress3.Visible = True
Me.Label1.Caption = "30%"
 

namliam

The Mailman - AWF VIP
Local time
Today, 21:40
Joined
Aug 11, 2003
Messages
11,695
Me refers only to the CURRENT form that the code is IN
If you want to refer to another form, you have to refer to that form specificaly, using something like...

Forms("Formname").labelname.visible

This is air code, you may need something like
Forms("YourForm").Labels("Labelname')
or
Forms("YourForm").controls("Labelname')

To lazy to go look it up for you :(
 

ccondran08

Registered User.
Local time
Tomorrow, 03:40
Joined
Feb 27, 2014
Messages
58
Thanks namliam, worked like a treat.

Forms("frm_Rollover_Progress").lblProgress1.Visible = True
 

Users who are viewing this thread

Top Bottom