By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,469 Members | 2,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,469 IT Pros & Developers. It's quick & easy.

hiding fields in forms

P: n/a
I have a form in which I only want certain boxes to show under certain
conditions, for example, when a transaction is selected as "commission" I
need to show the fields for entering the relevant information but to hide
them when any other type of transaction is selected.

How do I change the "visible" property of a particular field
programmatically so that it reverts to normal after the event?
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This takes a bit of programming to do... You need it in a couple of
different events;
a. The Form_Current event, must handle this, when scrolling through the
records..
b. The _Click event of the transaction type (assuming it is a combo box),
must handle this, when changing from a commission to normal transaction...

Some example code, could look like the below.. This has a combo field called
'd_type' which has the values 'Commission' and 'Standard'... When the record
is changed, or the transaction type is changed, it shows a date field and
hides the amount field (for a Commission type) or hides the date field and
shows the amount field (for the Standard type).

Option Compare Database
Option Explicit

Sub SetVisibleProperties()
If d_type.ListIndex = 0 Then 'Commission
[amount].Visible = False
[date].Visible = True
Else 'Other
[amount].Visible = True
[date].Visible = False
End If
End Sub

Private Sub d_type_Click()
SetVisibleProperties
End Sub

Private Sub Form_Current()
SetVisibleProperties
End Sub

Private Sub Form_Load()
SetVisibleProperties
End Sub

"George Steward" <go*****@clara.net> wrote in message
news:10****************@ersa.uk.clara.net...
I have a form in which I only want certain boxes to show under certain
conditions, for example, when a transaction is selected as "commission" I
need to show the fields for entering the relevant information but to hide
them when any other type of transaction is selected.

How do I change the "visible" property of a particular field
programmatically so that it reverts to normal after the event?


Nov 12 '05 #2

P: n/a
Thanks Ruskin
That looks exactly what I want, I need to reveal 3 fields when 'commission'
is selected and hide them at all other times as they are then irrelevant.

George

"Ruskin" <ru******@nospam.xtra.com> wrote in message
news:ov*******************@news.xtra.co.nz...
This takes a bit of programming to do... You need it in a couple of
different events;
a. The Form_Current event, must handle this, when scrolling through the
records..
b. The _Click event of the transaction type (assuming it is a combo box),
must handle this, when changing from a commission to normal transaction...

Some example code, could look like the below.. This has a combo field called 'd_type' which has the values 'Commission' and 'Standard'... When the record is changed, or the transaction type is changed, it shows a date field and
hides the amount field (for a Commission type) or hides the date field and
shows the amount field (for the Standard type).

Option Compare Database
Option Explicit

Sub SetVisibleProperties()
If d_type.ListIndex = 0 Then 'Commission
[amount].Visible = False
[date].Visible = True
Else 'Other
[amount].Visible = True
[date].Visible = False
End If
End Sub

Private Sub d_type_Click()
SetVisibleProperties
End Sub

Private Sub Form_Current()
SetVisibleProperties
End Sub

Private Sub Form_Load()
SetVisibleProperties
End Sub

"George Steward" <go*****@clara.net> wrote in message
news:10****************@ersa.uk.clara.net...
I have a form in which I only want certain boxes to show under certain
conditions, for example, when a transaction is selected as "commission" I need to show the fields for entering the relevant information but to hide them when any other type of transaction is selected.

How do I change the "visible" property of a particular field
programmatically so that it reverts to normal after the event?



Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.