If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Hide check box if text box is blank
Hi
I've had a look through some other similar discussions here but haven't been able to work out what I need to do here. I have a check box on my form called ActComplete and beside it a text box that is called ActDesc. The text box refers to a column in another table using =[Incident_Type].Column(3) which is filled in depending on the choice from a drop-down box called Incident_Type. However, sometimes (and correctly) the Column(3) contains no information and so my text box shows as blank on the form - which is fine, but in this situation, I would like the check box to be hidden - how can I do this? (in easy steps, please!) Thanks for your advice Martyn Access 2000, Windows 2003 server over Citrix PS4 |
#2
|
|||
|
|||
Hide check box if text box is blank
Here are some thoughts, but the real answer depends on the
relationship of the forms which is not clear from your description. 1) one possibility is in the afterupdate of the combo box put if isnull(me.Incident_Type.column(3) then me.chkboxname.visible = false else me.chkboxname.visible = true endif Basically it comes down to some event has to be triggered that then makes the test either to the combobox column 3 value or the txtbox value for null and set the chkbox visibility appropriately. That can be onopen or onload or oncurrent of the form if the items are on different forms (maybe) or just the afterupdate of the combo if the chkbox field is addressable at that time. We need more information to give a more specific answer. Ron |
#3
|
|||
|
|||
Hide check box if text box is blank
Hi Ron
Thanks for your thoughts - I tried the code in the After Update event of the combo box but it did not work. Sorry if I did not make myself clear. I'll try again: I have only one form, based on one table called Incidents. On the form is a combo box field from this table called Incident_Type, which looks up it's values from the first column in another table - Incident_Policy. A user must select a value from this list on the form. In the Incident_Policy table the 4th column contains details of a policy or procedure number that must be read and agreed to. Back to the main Incidents form; this then contains a text box called ActDesc, which is not connected to any table as I did not want to store this value. Instead, I used =[Incident_Type].Column(3) to display the policy details only on the form. Beside this is a check box called ActComplete which IS a field in the Incidents main table. This was intended as a visual check only to confirm that the user has seen the details of the relevant policy number, but some incidents do not have an associated policy at all, hence no text in column 4 of those rows of the Incident_Policy table, and I do not want the check box to show on the form in that instance. Hope this makes more sense Martyn "Ron2006" wrote: Here are some thoughts, but the real answer depends on the relationship of the forms which is not clear from your description. 1) one possibility is in the afterupdate of the combo box put if isnull(me.Incident_Type.column(3) then me.chkboxname.visible = false else me.chkboxname.visible = true endif Basically it comes down to some event has to be triggered that then makes the test either to the combobox column 3 value or the txtbox value for null and set the chkbox visibility appropriately. That can be onopen or onload or oncurrent of the form if the items are on different forms (maybe) or just the afterupdate of the combo if the chkbox field is addressable at that time. We need more information to give a more specific answer. Ron |
#4
|
|||
|
|||
Hide check box if text box is blank
Ok, we will both try again.
1) is it Datasheet, Continuous or Single Form? 2) Is the presense of the value in the txtbox appear as you intend or want it to? Ron |
#5
|
|||
|
|||
Hide check box if text box is blank
Hi
1) Single form. 2) Yes, when there is text in that column it shows in the text box as per the item selected from the combo box list. When theres nothing there, nothing shows - perfect. I have question though, does the presence of =[Incident_Type] etc in the text box on the form prevent the IsNull from seeing that box as null? Martyn "Ron2006" wrote: Ok, we will both try again. 1) is it Datasheet, Continuous or Single Form? 2) Is the presense of the value in the txtbox appear as you intend or want it to? Ron |
#6
|
|||
|
|||
Hide check box if text box is blank
My gut feel is no.
Have you tried pointing the condition test to the combox.column(3) instead of the txt box? That would eliminate any possible confusion. Also in this case the condition code needs to be in both the onCurrent and the afterupdate. Afterupdate resets it for when new info is selected in the combo and OnCurrent sets it for existing records, for which you are NOT change the value. Ron |
#7
|
|||
|
|||
Hide check box if text box is blank
We're getting there - it half works now. I have the following code in the
OnCurrent and AfterUpdate events of the form: If IsNull(Me.[Incident_Type].Column(3)) Then Me.ActCompleteVisible = False Else Me.ActComplete.Visible = True End If Now, when I go to enter a new record, the check box is not visible at first (which is fine as no option has yet been selected from the combo). But when I select an option with a policy, the text box displays the policy info, but the check box does not display at all. "Ron2006" wrote: My gut feel is no. Have you tried pointing the condition test to the combox.column(3) instead of the txt box? That would eliminate any possible confusion. Also in this case the condition code needs to be in both the onCurrent and the afterupdate. Afterupdate resets it for when new info is selected in the combo and OnCurrent sets it for existing records, for which you are NOT change the value. Ron |
#8
|
|||
|
|||
Hide check box if text box is blank
Because it is in the afterupdate it will not display until you get off
of the field. If you have limit to list set to Yes then you could do it also in the after change event. This causes it to be done "more frequently" but not too much depending on how many keystroks it takes to get to the value you will accept. since each keystroke is a change in the value. Try to have an intermediate field to tab to after the combo so you can check the afterupdate Ron |
#9
|
|||
|
|||
Hide check box if text box is blank
Well, I have the code as before in the AfterUpdate & OnCurrent events of the
form and the OnChange event of the Incident_Type combo. It works, but if you go back and re-select from the list to an incident without a policy detail, the wording in the text box goes, but the check box remains. This is a problem as the user might accidentally select the wrong incident type and have to go back and reselect, but the check box remains whatever. How could I get around this - it's so nearly exactly what I wanted? "Ron2006" wrote: Because it is in the afterupdate it will not display until you get off of the field. If you have limit to list set to Yes then you could do it also in the after change event. This causes it to be done "more frequently" but not too much depending on how many keystroks it takes to get to the value you will accept. since each keystroke is a change in the value. Try to have an intermediate field to tab to after the combo so you can check the afterupdate Ron |
#10
|
|||
|
|||
Hide check box if text box is blank
If the check box is for display purposes only, you could replace it with a
text box that uses a Winddings character to simulate a text box. You can then use Conditional Formatting (instead of writing code) to hide the contents of the text box (e.g. white on white.) This article explains how: Format check boxes in reports at: http://allenbrowne.com/ser-52.html (I realise you're doing this in a form.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "WembleyBear" wrote in message ... Well, I have the code as before in the AfterUpdate & OnCurrent events of the form and the OnChange event of the Incident_Type combo. It works, but if you go back and re-select from the list to an incident without a policy detail, the wording in the text box goes, but the check box remains. This is a problem as the user might accidentally select the wrong incident type and have to go back and reselect, but the check box remains whatever. How could I get around this - it's so nearly exactly what I wanted? "Ron2006" wrote: Because it is in the afterupdate it will not display until you get off of the field. If you have limit to list set to Yes then you could do it also in the after change event. This causes it to be done "more frequently" but not too much depending on how many keystroks it takes to get to the value you will accept. since each keystroke is a change in the value. Try to have an intermediate field to tab to after the combo so you can check the afterupdate |
|
Thread Tools | |
Display Modes | |
|
|