Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming conventions - help needed 1

Status
Not open for further replies.

lrumd

Technical User
Sep 5, 2002
25
0
0
US
I can't seem to be able to "address" a certain control when I am writting code in my main form.

Let me explain:

frmMain subfrmSecond subfrmThird
LastName EntryDate Item
FirstName Place Amount
... ... ...
... ... ...

Due to the relationships between the tables, subfrmSecond is a subform of frmMain, and subfrmThird is a subform of subfrmSecond.

I want subfrmSecond to become visible when LastName <>&quot;&quot;
No problem. I wrote code in Private Sub Form_Current()
and it works fine.

Now, when the user enters information in the subfrmSecond.EntryDate I want subfrmThird to become visible. The problem is that when I write code in the Private Sub Form_Current() section of the main form, I can't seem to &quot;find&quot; the subfrmSecond.EntryDate control (i.e. it does not appear in the drop down menu when I press the &quot;dot&quot;). Nor can I find it if I try writting code in the subfrmSecond.

Am I making sense? What am I doing wrong?.

I have tried:
Me. .....
Me!. .....
Form. .....
Forms!. ....
Form(&quot;subformthird&quot;). ....
Form.[subfrmSecond]. .....
Form.[Form_subfrmSecond Subform]. ....
etc....

Someone please help

Where should I be writting the code in the main form, on the subfrmSecond, the subfrmThird??

Confused,

Luis
 
For something to happen, you have to trigger an event. Ther are a numbr of triggers. Before_update, after_update, oon_click, on_double_click and etc. Some are a bit obscure so you will have to experiment. Put a

msgbox &quot;I am after update&quot; at the

critical spots and test them till you know what they are going to do.

Rollie E
 
I'm not sure of the syntax...but you have to have this happen in the &quot;On Update&quot; event of the EntryDate control. You also cannot directly reference subform 3 since you are trying to do it from subform 2 (which can only see its parent)...so basically you have to reference the parent form's subform 3, not just subform 3. Sorry I don't know offhand the exact syntax, I'm sure someone else can help with that if you can't figure it out...hope that helps.

Kevin
 
Ok, I have been able to determine when the AfterUpdate event triggers. Now I this is what I have, but it's not liking it:

Private Sub ApptDate_AfterUpdate()
If Me.ApptDate.Value <> &quot;&quot; Then
Forms![frmPatients]![subfrmOrders subform]!Visible = True
End If
End Sub

I am trying to make the subform become visible (obviously) but I get an error 2455 (&quot;can't find the field 'visible' referred to in your expression&quot;)
Thanks
Luis
 
That got you a star and a medal [medal]
Thanks, godawgs!!
Luis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top