reference forms

Jim8541

Registered User.
Local time
Today, 13:32
Joined
Aug 13, 2004
Messages
14
Hi, I read the FAQ but still can't get it. I keep getting an Access error "Access can't find frmMain". Here's my set up. I have a main form (frmMain). On that I put a tab control(tabctl59). On the second tab I dragged a form(frmRef2) that I created by itself. On frmRef2 I placed a subform(SubFrmRef). So frmMain->frmRef2->SubFrmRef. I linked my subform(SubFrmRef) to frmRef2 via a combo box(cboRefName). In my subform(SubFrmRef) in the before Update event of the form I want to run a function. I need to get data from the combo box on frmRef2. I tried Forms!frmMain!frmRef2.cboRefName.column(0) but I get an error. I tried me.parent.cboRefName. Also in this same before_Update event I used
Code:
 dim FR as form: set FR= Forms!frmMain!frmRef2
I get the same error. I know I need to use .form when refering to a subform but I'm only refering to a form inside of a form. Any ideas?
Thanks, Jim
 
1) The form(s) need to be open in order for the code to find it.

2) Try building the statement using the query builder. Open a new query, dont add any tables...
Right click on the first field.
Choose build.
Now find forms and click to where you want to be. Access will build the full and correct statement for you...

Regards & GL

P.S. Instead of using Forms!Name you can also use Forms("Name")
Or use Forms(1) where the 1 is an index of all the forms that are open.
 

Users who are viewing this thread

Back
Top Bottom