change properties entrycells on subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to make a celle active for dataentry only if another cell is set to "other"
I put a small code into the "after update event" (see on bottom of letter).
It works as long as I run the subform alone.. .. my cell is only active for entry when "FK_Householdaccestype = 4".
BUT when it have to run in the main form as a subform .. first I got that it could not find the form.. then I added the name of teh "mainform" (Basefarminfo!). Now I get the error "Object dosntt support this property or method"

WHAT CAN I DO?

I would also like the cell to get "enabled=false" after entering/choosing entry but the program only alowws me to make it "enabled=false" when I enter a new field

ANY suggestion?

Best wishes
Reno Lindberg

Private Sub Householdacces_AfterUpdate()
On Error GoTo HouseholdAcces_AfterUpdate_Err

If (Forms!Basefarminfo!Basefarminfo_sub_householdaccestype!FK_Householdaccestype = 4) Then
Forms!Basefarminfo!Basefarminfo_sub_householdaccestype!AccessubType.Enabled = True
End If
Me.Refresh

HouseholdAcces_AfterUpdate_Exit:
Exit Sub

HouseholdAcces_AfterUpdate_Err:
MsgBox Error$
Resume HouseholdAcces_AfterUpdate_Exit

End Sub
 
Your syntax is incorrect. Replace If ... Then ... EnfIf with

Forms!Basefarminfo!Basefarminfo_sub_householdaccestype.Form!AccessubType.Ena
bled =
(Forms!Basefarminfo!Basefarminfo_sub_householdaccestype.Form!FK_Householdacc
estype = 4)

To reference to subform you have to use .Form property succeding the subform
control (Basefarminfo_sub_householdaccestype0 to tell access that this is a
form, not a control, and anything (properties, methods) I reference after
this is depend on Form object.

Hope this may help

Reno Lindberg said:
I would like to make a celle active for dataentry only if another cell is set to "other"
I put a small code into the "after update event" (see on bottom of letter).
It works as long as I run the subform alone.. .. my cell is only active
for entry when "FK_Householdaccestype = 4".
BUT when it have to run in the main form as a subform .. first I got that
it could not find the form.. then I added the name of teh "mainform"
(Basefarminfo!). Now I get the error "Object dosntt support this property or
method"
WHAT CAN I DO?

I would also like the cell to get "enabled=false" after entering/choosing
entry but the program only alowws me to make it "enabled=false" when I enter
a new field
ANY suggestion?

Best wishes
Reno Lindberg

Private Sub Householdacces_AfterUpdate()
On Error GoTo HouseholdAcces_AfterUpdate_Err

If
(Forms!Basefarminfo!Basefarminfo_sub_householdaccestype!FK_Householdaccestyp
e = 4) ThenForms!Basefarminfo!Basefarminfo_sub_householdaccestype!AccessubType.Enabled
= True
 
Back
Top