G
Garry Jones
I am hiding or showing a textbox on a form depending on whether or
not it is empty. As I want to do this for more textboxes I would like
reduce the coding for this proceedure.
I can't quite grasp the syntax and would be gratefull for any help.
Ideally I would just run the same proceedure on a number of textboxes
and send each textbox to the same proceedure to show or hide.
This is what I am doing
Private Sub Form_Current()
If IsNull([Dat1]) Then
hdbx1
Else
shwbx1
End If
If IsNull([Dat2]) Then
hdbx2
Else
shwbx2
End If
End Sub
Private Sub shwbx1()
Dat1.Visible = True
End Sub
Private Sub hdbx1()
Dat1.Visible = False
End Sub
Private Sub shwbx2()
Dat2.Visible = True
End Sub
Private Sub hdbx2()
Dat2.Visible = False
End Sub
Very longwinded and as I have a lot more textboxes I really want to make
this code more concise. This is what I have in mind...
Private Sub Form_Current()
chk[dat1],[dat2], etc
(i want this to send each textbox in turn to chk, can't grasp syntax)
End Sub
Private Sub chk()
(I want to use the "IsNull" and then send each textbox on to either one
of the following proceedures according to result of "IsNull", can't
grasp syntax)
End Sub
Private Sub shwbx()
"actual textbox".visible = true
End Sub
Private Sub hdbx()
"actual textbox".visible = false
End Sub
Garry Jones
Sweden
not it is empty. As I want to do this for more textboxes I would like
reduce the coding for this proceedure.
I can't quite grasp the syntax and would be gratefull for any help.
Ideally I would just run the same proceedure on a number of textboxes
and send each textbox to the same proceedure to show or hide.
This is what I am doing
Private Sub Form_Current()
If IsNull([Dat1]) Then
hdbx1
Else
shwbx1
End If
If IsNull([Dat2]) Then
hdbx2
Else
shwbx2
End If
End Sub
Private Sub shwbx1()
Dat1.Visible = True
End Sub
Private Sub hdbx1()
Dat1.Visible = False
End Sub
Private Sub shwbx2()
Dat2.Visible = True
End Sub
Private Sub hdbx2()
Dat2.Visible = False
End Sub
Very longwinded and as I have a lot more textboxes I really want to make
this code more concise. This is what I have in mind...
Private Sub Form_Current()
chk[dat1],[dat2], etc
(i want this to send each textbox in turn to chk, can't grasp syntax)
End Sub
Private Sub chk()
(I want to use the "IsNull" and then send each textbox on to either one
of the following proceedures according to result of "IsNull", can't
grasp syntax)
End Sub
Private Sub shwbx()
"actual textbox".visible = true
End Sub
Private Sub hdbx()
"actual textbox".visible = false
End Sub
Garry Jones
Sweden