Q about subforms & dates

afnan_88

Registered User.
Local time
Today, 09:02
Joined
Jun 16, 2010
Messages
27
hello... i hope all of you fine =)

ihave small q

if i have a subform
and i want to disable some controls in the mainform acording to the value of a control in the sub form >> how can i access the main form control ??
i try many lines in the after update events but i get a msg that the control doesn't exist

another thing
how can i change all the dates to the british format ?


thanx in advance..
 
Perhaps this link will help you arrive at the correct syntax for referencing your various forms.
 
thank you
but previously ,i try this one
Me.Parent!ControlName
but i get the same msg
 
thank you
but previously ,i try this one
Me.Parent!ControlName
but i get the same msg
What did you put for ControlName? What is your control's name on the main form you wish to deal with?
 
this is my code this event is in the sub form and the control in the main form

Private Sub Ctl118_Positive_family_history_of_IBD_AfterUpdate()
If Ctl118_Positive_family_history_of_IBD = 2 Then
Me.Parent!Ctl120_Type_of_IBD.Enabled = False
Else
Me.Parent!Ctl120_Type_of_IBD.Enabled = True
End If

End Sub
-------------------------

the error msg : cannot find the field 'Ctl120_Type_of_IBD' referred in your exp.
 
Last edited:
I suspect it should be:
Code:
Private Sub Ctl118_Positive_family_history_of_IBD_AfterUpdate(  )
    If Ctl118_Positive_family_history_of_IBD = 2 Then
        Me.Parent.[COLOR=Red][[/COLOR]Ctl120 Type of IBD[COLOR=Red]][/COLOR].Enabled = False
    Else
        Me.Parent.[COLOR=Red][[/COLOR]Ctl120 Type of IBD[COLOR=Red]][/COLOR].Enabled = True
    End If
End Sub
Where the underscore should be a space.
 
vbaInet

i try your code but it dosent work . but you inspire me to replace "!" by "." in my code and its working now =)
---------------------------------------
Private Sub Ctl118_Positive_family_history_of_IBD_AfterUpdate()
If Ctl118_Positive_family_history_of_IBD = 2 Then
Me.Parent.Ctl120_Type_of_IBD.Enabled = False
Else
Me.Parent.Ctl120_Type_of_IBD.Enabled.Enabled = True
End If

End Sub


thanq all
i hope somone can answer my 2nd Q>>
 
In the Format property of the textbox, put something like:

dd\/mm\/yyyy
 

Users who are viewing this thread

Back
Top Bottom