Hiding Controls on a form based on query results

  • Thread starter Thread starter John Castle
  • Start date Start date
J

John Castle

I have a form with multiple controls on. Some of the
controls are not relevant to some of the records displayed.
What do I have to write in the Oncurrent property in order
to make the controls invisible under certain criteria?
 
Hi,
in your case i'll create a Function called ENABLECONTROL which gets call from OnCurrent event.

Private Sub Form_Current()
if NOT me.newrecord than
Select Case me.CriteriaControl.Value
Case Value1
Call ENABLECONTROL(TRUE, FALSE, TRUE)
case Value2
Call ENABLECONTROL(FALSE, TRUE, TRUE)
else
end select
end if
End Sub

Function ENABLECONTROL(bT1 as boolean, bT2 as boolean, bT3 as boolean,........,bTn as boolean)
with me
.txtT1.Enabled = bT1
.txtT2.Enabled = bT2
.txtT3.Enabled = bT3
-
-
.txtT4.enabled = bTn
end with
End function

HTH
 
use an if statement to check the record. If you have
field in your record table that distinguishes between one
type of record and another type of record, the reason for
having un-needed controls, the all you have to do is
check for the flag. IE,
IF [type] = C then
textbox.visible = false
combobox.visible=false
textbox2.visible=true
Else
textbox.visible = true
combobox.visible=true
textbox2.visible=false
End If
-----Original Message-----
Me![ControlName].Visible = False
-----Original Message-----
I have a form with multiple controls on. Some of the
controls are not relevant to some of the records displayed.
What do I have to write in the Oncurrent property in order
to make the controls invisible under certain criteria?
.
.
 
Back
Top