I am attempting to automate the process of displaying certain fields and labels on a form based on a tick box selected at the side ("Not Applicable")
Here is the code I am using but I can't seem to get it to work, it errors with 438 errors among other errors.
Dim NA, NALabel, NAMain, NADate, NABy
NA = [FacAlarmNA]
NALabel = [FacAlarmNALabel]
NAMain = [FacAlamrm]
NADate = [FacAlarmDate]
NABy = [FacAlarmBy]
If NA = True Then
NALabel.Visible = True
NAMain.Visible = False
NADate.Visible = False
NABy.Visible = False
NAMain = False
'NADate = ""
'NABy = ""
NALabel.Visible = False
NAMain.Visible = True
NADate.Visible = True
NABy.Visible = True
As I have 10 or more tick boxes (NA) on each form linked to different fields each, this way I could change the top part to the new fields under the click event of each NA tick box and that way saves me less work when doing a whole page of NA tick boxes and fields.
It works when I manually do this, what I mean is when I type the fields into the above instead of linking them it works fine - just wanted to automate the process a bit, saves me typing the fields into 20 lines, rather than just the first 5 as above...
[FacAlarmNA].visible instead of the dim and also remember - you cannot hide a control that has the focus - so before hiding a control move the focus to another control - preferably the next control that needs to evaluated
also that error is usually associated with data binding
and sometimes if evaluating a yes/no field I always use -1 or 0 or if it is true/false on the form I use cint(truefalsefieldname) to get the numeric value -1 or 0
that doesn't help. the idea of the the dim statements is so I only have to change the top 5 lines rather than all the lines below that - i have it working fine on [FacAlarmNA].visible - is there a way to link it to a stored statement? only for each click, so don't need to store it beyond that command.