Textbox Visible depending on field value

MrRundog

Happy User
Local time
Today, 03:53
Joined
Mar 8, 2008
Messages
44
Hi - Trying to make a textbox visible depending on the value of another field...

This is the psudo

Code:
If [somefield]=3 Then
Text1.Visible=True
Elsif [somefield]=2 Then
Text2.Visible=True
Else
Text3.Visible=True
End If

Not sure where to put this on the report or for that matter if my syntax is correct for the visibilty part.

Andy
 
first you need stuff like this in the current event for the form

then you need to call it from the afterupdate event of any control that might have some effect on the display
 
Ah - right - So in a report that might be a problem I guess?
 
in a report you need to mess around in either of the reportdetail events

either format or print events - both will probably work

--------
sorry should have noticed this was in the reports thread!
 
Fantastic - I got it to work in the Detail Format Event on the Report

& for those searching - here's the code I used

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

   Select Case vehLocation

      Case 3
        Me.Text21.Visible = True
        Me.Text22.Visible = True
        Me.Text23.Visible = True
      Case 2
        Me.Text31.Visible = True
        Me.Text32.Visible = True
        Me.Text33.Visible = True
      Case Else
        Me.Text41.Visible = True
        Me.Text42.Visible = True
   End Select
End Sub

vehLocation returns a number from the field in my table (either 3 2 1)


I now have Layers which are visible if the condition is met - Much better than making the text white as you can lay these ontop of each other! PS Don't forget to make your control Visible No

Cheers Gemma

Andy
 
Hi,

The Visibility Property of the textbox doesn't take effect ?

(Me.txtjob.BackColor = 16777215)

where , it works properly with the "Detail" , Like :

(Detail.BackColor = 16777215)

Any ideas ?
 

Users who are viewing this thread

Back
Top Bottom