|
-
Apr 25th, 2002, 11:15 AM
#1
Thread Starter
New Member
accessing values from 1 form to another
If I have a checkbox on one form, and I want to access it's value on another form, what do I do? Any held would be great. Thanks.
-
Apr 25th, 2002, 11:17 AM
#2
Addicted Member
-
Apr 25th, 2002, 11:22 AM
#3
mepaco's code is right.
I usually have a couple forms at least on most of my apps.
Am always sending data back and forth between them.
Only thing you have to watch out for is making sure any changes are reflected in linked forms.
I usually end up with
if frmMain.checkbox1.value = 1 then
msgbox "You have checked on the main form.",vbokonly
else
msgbox "You do not have checked on the main form.",vbokonly
end if
this would check to see if the main form was checked, could place it in any form.
Also can call functions from any form like this.
'GetDir function grabs the apps path.
strPath = fmMain.GetDir
then u save coding by only needing the fuction in one form.
-
Apr 25th, 2002, 11:32 AM
#4
Addicted Member
I'm guessing since this is a checkbox you won't have to work with it much but if you did then you could always set a reference to it and make it easier to work with, and more efficient I believe.
VB Code:
Dim checkbox1 As CheckBox
Set checkbox1 = Form1.checkbox1
If checkbox1.Value Then 'This is the checkbox on Form1
checkbox1.Enabled = False
End If
If you set a reference to it like this then you can work with it just like it was a local control.
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
|