Checkboxes and Subforms

WackyWaterGuy

Registered User.
Local time
, 20:22
Joined
May 29, 2003
Messages
25
HI everyone!

Hope you all are doing well today. Just a quick question about a a probem I cant seem to solve for the life of me. I have a main form, and within it, subforms. I am setting up a dynamic query system, which I have successfully done when the checkboxes are on the mainform (where the code to create and run the query exists). Now I am trying to put different groups of options on to different subforms (in tabs), have the user go through those tabs, select the boxes they wish, and then click a button on the main form to run the query. My problem is stemming from the fact that I cannot seem to reference the checkbox on the subform.

Below is a little snip of code to show what I have been trying to do:

Code:
If [Forms].[GVLLayout].[GVL Shift A] = -1 Then  [COLOR=green]'(<--this is where the code is barfing...the rest of it works!)[/color]
        Shift = Shift & ",'A'"
    End If

Can anybody make a suggestion as to how I can reference this checkbox??

Please get back to me, as any help would be greatly appreciated!

Thanks

WWG
 
Try this:
Forms![MainFormName]![SubformName]![ControlName]
 
Hi Carmen....Thanks for you input, but that doesnt seem to work either.

I keep getting an error saying that it "cannot find the Field "GVLLayout" referred to in my expression".

But the funny thing is...."GVLLayout" is my subform, not a field. Could the problem stem somehow from this??

Let me know what you think people!

THanks

WWG
 
My fault--I left out a part!!!! Sorry!

Try this:
Forms![MainFormName]![SubformName].Form![ControlName]

See if that helps......
 
Sorry Carmen, it still says can't find the field GVLLayout.
The direct translation from your input looks like this ...

Code:
If Forms![ReportQuery]![GVLLayout].Form![GVL Shift A] = -1 Then ...

Thanks again for you help

WWG
 
Last edited:
OK, this might be a stupid question but is ReportQuery the name of your Form or is that the name of a query?
 
Hi Carmen

ReportQuery is the form (probably a bad wording scheme) :D . GVLLayout is the subform inside the tabs (this is a gerenic layout for the check boxes).

The query is called from ReportQuery and queried against the check boxes within GVLLayout.

I think between you and me ... I am going to be doing some renaming of the forms / subforms. ;)


Thanks for all your help

WWG
 
Let me ask you this.....

Is GVLLayout the name of the subform control as well? You may need to do this if they are different:

Forms![MainFormName]![SubformControlName].Form![ControlName]


PS: I won't tell anybody if you change the names! ;)
 
Is GVLLayout the name of the subform control as well? You may need to do this if they are different:

Forms![MainFormName]![SubformControlName].Form![ControlName]

Actually GVLLayout is the subform inside of ReportQuery. The name of the check box is [GVL Shift A]

Forms![MainFormName]![SubformControlName].Form![ControlName]

In your example, ControlName would be GVL Shift A ... right?

Ok, so my next question to you is this...What is [SubformControlName] then?? Is this the same thing??

Have I totally screwed everything up??

HELP!!

THanks Carmen!
 
Open the form in design view and use the code builder to get the correct form references
 
Carmen!!


Thanks for you help

We figured it out. Sorry for wasting your time...you are going to laugh (hopefully) when you hear what happened. There are two of us working on this project...and what it came down to was a mismatch in the naming. The form we used to make our subform was called GVLLayout....and the Subform was named GVL Layout (note the space!) So, one space buggered us up ALL day!

Lesson Learned = Stick with one naming convention!!!!

Thanks again Carmen!!

WWG
:p
 
Hey WWG!! Been there, done that!! Glad you got it figured out. And it's never a waste of time to try and help. I know this forum has saved my butt a time or two!!!! :D
 

Users who are viewing this thread

Back
Top Bottom