|
-
Sep 10th, 2002, 12:22 PM
#1
Thread Starter
New Member
VBA Referencing Variables from Form
Hey all, just have a quick problem.
I'm working on an Access form that has a subform. I need the subform to pull some information from another database table, but in order to do that, I need to make some dynamic query statements, using variables from the main form. I'm unsure how this can be done. There are plenty of sites online that explain how to get variables from the subform to the main form, but I haven't found any that are vice versa.
Can anyone give me an example? Thanks in advance!
-
Sep 11th, 2002, 03:58 AM
#2
Fanatic Member
should be as easy as this:
Me.txtOne = [Forms]![myMainForm].txtTwo
This takes data from textbox "txtTwo" on the main form "myMainForm" and puts it in the "txtOne" textbox on you subform....
-
Sep 12th, 2002, 02:36 AM
#3
You'll be lucky gaffer 
Subforms are nightmares... avoid them and use a listbox instead (personal view)
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Sep 12th, 2002, 04:22 AM
#4
Fanatic Member
Reference to the subform has always been a nightmare, but a reference to the main form is pretty easy I thought: I tested my theory out before I posted ...
-
Sep 12th, 2002, 04:41 AM
#5
Yup true.
I'll read more carefully in the future 
You can also use Forms("formname").Controls("Controlname") but not when using instances...
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
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
|