|
-
Jan 12th, 2006, 05:56 AM
#1
Thread Starter
Hyperactive Member
VBA Question
Dear all,
I am working on an Access file, and inside there, I have a lot of forms, but I need to somehow pass a variable from one form to the other, can anyone show me how to do that?
thank you very much
PlayKid
-
Jan 12th, 2006, 06:10 AM
#2
Hyperactive Member
Re: VBA Question
any variables that I want to be available to ALL forms, I usually put in a module
Now, I can do the following in frmMain
VB Code:
Private Sub cmdInput_Click()
strData = "w00t"
frmTwo.Show
End Sub
and for frmTwo's Form_Load:
VB Code:
Private Sub Form_Load()
Me.Caption = strData
End Sub
Now, frmTwo's Caption would be equal to a variable that you set in frmMain.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Jan 12th, 2006, 06:36 AM
#3
Thread Starter
Hyperactive Member
Re: VBA Question
Can I say something like this?
VB Code:
TextBox12 = [Form 1].[TextBox11]
-
Jan 12th, 2006, 06:47 AM
#4
Re: VBA Question
 Originally Posted by PlayKid
Can I say something like this?
VB Code:
TextBox12 = [Form 1].[TextBox11]
If TextBox12 is a global variable like LostAngel posted, then yes.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|