473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

hiding fields in forms

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
2 1941
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
2
by: Tim Graichen | last post by:
I currently have a form with several combo boxes. I have the background properties and boarder properties of all form fields set as transparent. Therefore, the only part of the controls that are...
2
by: George Steward | last post by:
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...
17
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that...
22
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said...
5
by: Ivan | last post by:
I am used to VB6 and am not sure how to do this in Vstudio .NET. I have a main form which calls other forms. I want to disable that main form while other ones are called. I tried hiding it and...
11
by: Kevin | last post by:
I've got a timer on my MDI parent form. If there's no mouse movement for a set number of minutes, the Visible property of all open forms is set to False and the Log On form is displayed. I could do...
2
RobH
by: RobH | last post by:
I have a frm_PrintQuote that launches rpt_Quotation rpt_Quotation includes a subform frm_QuoteParts frm_QuoteParts has a field SubPrice On the frm_PrintQuote I have a check box that indicates...
1
by: RLN | last post by:
I have a form that is set to "continuous forms" view. Several rows of data are shown to the user at the same time. I want to set FieldX and FieldY to true and show them only if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.