0

have two form
in one form i salect some thing and click on done button a mesage box prompt me that u selcet this and this

and on the other form a button result is place.. when i click on it a new form appears and the msg box text that appears on msg box appears in label which is on 3rd form... now what i do .. its not run first i do simple coading but i think its nt rgt

'for first form 
Dim p As Integer
Private Sub Command1_Click()
p = MsgBox("thanku your text box value is" & vbCr & Text1.Text)
End Sub 

'form 3rd form
Dim p As String
Private Sub Form_Load()
Label1.Caption = Form1.p
End Sub

its say method and data member not found its means all code is wrong what i do now... plzzz telll me .. rply fast

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by hkdani
0

Hi,


Your code should look like this :

'for first form 
Public Function GetMessageVal() As String
    GetMessageVal = InputBox("Enter New Value")
End Function
 
 
'form 3rd form
Private Sub Form_Load()
Label1.Caption = Form1.GetMessageVal
End Sub

Regards
Veena

0
'form 3rd form
Dim p As String
Private Sub Form_Load()
Label1.Caption = Form1.p
End Sub

You're using private variables from another form. If you want to use the variables from another form, you must declare those variables as Public and not Private.

Once you use Form1 followed by the period, then anything after the period belongs to the object Form1 and not to the form that you are currently on.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.