Button visible

  • Thread starter Thread starter nicksantopaolo
  • Start date Start date
N

nicksantopaolo

Guest
Hi could someone help me with the following please:

when a click on 'Button A' i want Button B, Button C and Button D (not yet visible) to appear. Then when i click on Button A again i want them to dissappear. Im sure this is easy!

Thanks
 
Basically an on click event on Button A

If Button B.visible=True then
Button B.visible=False
Button C.visible=False
Else
Button B.visible=True
Button C.visible=True
End If

L
 
This is what i wrote:

Private Sub ButtonA_Click()
If Button A.visible=True then
Button B.Visible = False
Button C.Visible = False
Else
Button B.Visible = True
Button C.Visible = True
End If

End Sub
 
nicksantopaolo said:
This is what i wrote:

Private Sub ButtonA_Click()
If Button A.visible=True then
Button B.Visible = False
Button C.Visible = False
Else
Button B.Visible = True
Button C.Visible = True
End If

End Sub


Not quite basically because I screwed up my bit

Try

Private Sub ButtonA_Click()
If Button B.visible=True then (changed this bit)
Button B.Visible = False
Button C.Visible = False
Else
Button B.Visible = True
Button C.Visible = True
End If



L
 
I did a search for visible and found this thread, it worked at first but I have discovered a problem, at least for me. I want this field to be visible/not visible based on a criterion from individual records. When the "Child Removed" checkbox is true I want it to appear on that record only and still be invisible on the other records. (I'm using a a data entry form, BTW) Here is the code I am using:

Code:
Private Sub Child_Removal_Click()
If Child_Removal = True Then
Child_Removal_Date.Visible = True
Else
Child_Removal_Date.Visible = False
End If
End Sub

How do I do this?
 
Are you using a continuous form

If so then this could be the problem. I think that the first record will determine the visibility. Not certain of that however

Please describe more fully exactly what is/not happening and the cirumstances. Need to know a bit more

Len
 
Gotcha. I'm not using a continuous form. Have to navigate at the bottom from record to record. When I mark the checkbox "true" it should open up a field in which I enter a date. It does this. Unfortunately, on the next record, the date box is also there, although the checkbox is "false". If I check that box "true" and then uncehck it, the field becomes invisible not only on that record, but on all the records.
 
Okay

Essentially you have available the complete set of records sort of in the background

Again what is happening is similar to the continuous forms description.

Do you want to edit a single record at a time or the whole set

Perhaps if you want to edit selected records then we could bring them up singly alternatively maybe a work around for multiple records.

I am off home in a few minutes so not sure where you are but will be logging on again at home this evening probably (sad I know but there you are)


Len
 
Ok, when I check the box "true" I want the date field to appear ONLY on that record. The other records should remain invisible unless I check the box "true" on those specific records.
 
One option would be to bring back only the record you want to edit.

So the way I would tackle this is

1) Have a form with a button on saying Select Record
2) Under this a combo box whose row source listed the basic identity of the records available.
3) On click property of button makes combo box appear.
4) On click property of combo box opens a form whose record source is a query that has a parameter that reads the contents of the combo box
5) You can then edit the single record and the visible switch will work correctly
6) Close form button firstly closes the enquiry form (1) and then re-opens it and then closes the edit form (4). Do this so that the combo box is re-hidden

Been thinking around IIF statement (immediate If) to handle the situation on a continuous form but at the moment do not have a proposal to offer. These do not run the same as If statementsand have a different structure.

I will think on it but maybe the single record solution will do the job for you if indeed you only want to update a specific record at a time.

Len
 
Shorter code

In response to the original question:

Hi could someone help me with the following please:

when a click on 'Button A' i want Button B, Button C and Button D (not yet visible) to appear. Then when i click on Button A again i want them to dissappear. Im sure this is easy!

Here's a way to do it with shorter code:
Code:
Private Sub ButtonA_Click()

Button B.Visible = Not Button B.Visible
Button C.Visible = Not Button C.Visible

End Sub
 
Thanks for the reply Len, but I would really like this VBA script to be record specific. The data entry will be continuous and will not really have the option of returning to records to change this info, as it would be inputted as the record was inputted.
 

Users who are viewing this thread

Back
Top Bottom