473,750 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Toggling .Visible for controls in Subform footer

Lyn
Hi,
I have a form which contains a number of subforms in different pages of a
tab control. In the detail section of each subform, I list records related
to the main form record, but from different tables. In the footer section
of the subform I have a Notes text box and three buttons (Add, Update,
Delete). The latter each open a separate form for updating or deleting the
subform data (the records cannot be updated or deleted directly from the
subform which is for display only). The Notes field displays an additional
(large) field from the record selected in the subform list.

The subforms are loaded via the Current event of the main form.

If there are no records to display in the subform, I would like to make the
Notes control and the Update and Delete buttons not visible (leaving just
the Add button visible). To do this, I created a recordset in the main form
Current event using the same SQL as that used to load the subform table. If
the record count is zero, then I set the .Visible property of the Notes
field and the two buttons to FALSE.

This works fine -- except that once made not visible, they cannot be made
visible again on a new main form record when the subform record count is GT
zero. In fact, through experimenting, I have found that just mentioning the
..Visible property of these controls via the main form Current event makes
them invisible -- even if the only mention is to set .Visible TRUE!

What is going on???

I realise that the footer contents are intended to remain static for all
records. Is this the problem, that it is "illegal" to make the contents
data dependent? Or what?

Any advice and assistance greatly appreciated. (Access 2003, WinXP)

--
Cheers,
Lyn.
Nov 13 '05 #1
5 5552
are you making sure that you set the visible to false on the others
when you make one visible? Sometimes overlapping can make it appear
that the one you want isn't visible.

I have an unbound form with several subforms which will appear
depending on which button you select. All of them overlap and are the
same size. I just turn one off then the other on and reset the focus
to where I want it to go.

As far as your footer contents. That shouldn't matter too much if you
just set the properties of something. I use the footer in one of my
forms for buttons to menus. Depending on the Access level of the user
they see different buttons. So having something in your footer
shouldn't matter too much if you need to set the .Visible property.

Nov 13 '05 #2
Lyn
Billie,
Thanks for your response. None of the objects in the footer overlap. I
just want to hide the Update and Delete buttons when there are no records to
update or delete.

Here is an extract from the main form's Current procedure where it loads the
subform when a new main form record is opened (main form is frmPerson):

'Display the record list in the subform
mySQL = "SELECT * FROM MiscRecs WHERE MiscRecs.IDPers on = " &
Nz(Forms.frmPer son!IDPerson, 0) & " AND RecordType = 'Education' "
Me.[sfmEducation].Form.RecordSou rce = mySQL
Me.[sfmEducation].LinkMasterFiel ds = ""
Me.[sfmEducation].LinkChildField s = ""

'Count the number of records displayed
RS.Open mySQL, Conn, adOpenStatic

'Show or hide Update and Delete buttons, and Notes field
'depending on RecordCount value
If RS.RecordCount > 0 Then
' Me.sfmEducation .Form!btnDelete .Visible = Yes
' Me.sfmEducation .Form!btnUpdate .Visible = Yes
' Me.sfmEducation .Form!Notes.Vis ible = Yes
'Else
' Me.sfmEducation .Form!btnDelete .Visible = No
' Me.sfmEducation .Form!btnUpdate .Visible = No
' Me.sfmEducation .Form!Notes.Vis ible = No
End If
RS.Close

All three buttons and the Notes control display correctly when the code is
commented out as shown. If I activate the commented code, the buttons and
the Notes field all disappear -- REGARDLESS of the value of RecordCount (and
I have verified that RecordCount values accurately reflect the number of
rows in the subform -- I have had all values from 0 to 6). The If statement
does take the correct path depending on the value of RecordCount.

It gets even weirder -- if I delete all the code from "RS.Open" onwards, all
buttons are visible. However, if I add just the following statement:

Me.sfmEducation .Form!btnDelete .Visible = Yes

the Delete button disappears -- even though the statement just forces the
button to be visible! Similar statements for the other button and Notes
also make these objects invisible.

Any ideas? Anyone?
--
Cheers,
Lyn.

"Billie Kennedy Jr" <da****@orpgs.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
are you making sure that you set the visible to false on the others
when you make one visible? Sometimes overlapping can make it appear
that the one you want isn't visible.

I have an unbound form with several subforms which will appear
depending on which button you select. All of them overlap and are the
same size. I just turn one off then the other on and reset the focus
to where I want it to go.

As far as your footer contents. That shouldn't matter too much if you
just set the properties of something. I use the footer in one of my
forms for buttons to menus. Depending on the Access level of the user
they see different buttons. So having something in your footer
shouldn't matter too much if you need to set the .Visible property.

Nov 13 '05 #3
I had problems with some of my stuff disappearing as well. Or not even
showing up properly. Right now I use Form_Current() for setting the
default values of fields and properties for my form. Once the form is
open I have all of the active code in Form_Activate() .

When a user chooses a record the form gets updated with the information
needed. When the user chooses a new form that updates the contents of
the first form and closes the new one then the first form is updated
with the new information as well.

I do have to say that the first form is an unbound form with no active
fields. If the user wants to edit any of the information on the first
form they have to open a different form. Those options are per user
access set by a user table.
Try the Form_Activate() function for your form instead of
Form_Current().

This helped me. It may help you.
--------------
Billie
http://www.orpgs.com

Nov 13 '05 #4
Lyn
It was worth a try. I hadn't tried it before because I understand Activate
to occur only when the form window becomes current after focus moves back to
it from another window, whereas I need the buttons to be updated when
scrolling from main form record to record. In fact, I use Activate to
Requery the subforms -- like your application, I don't update the subforms
directly, but call another form to do this. On return to the main form, the
subforms are requeried to update them according to the changes made in the
update form.

In fact, your comments made me realise that I also need to update the
buttons' visibility in the Activate event as well as the Current event (if I
delete the only row, then the subform will now be empty and the buttons need
to be hidden -- or if the subform was empty and I Add a record, the buttons
need to be made visible).

Anyway, I tried copying the button hide/show code into Activate, but it
still (mis)behaves the same way as in Current (after updating a subform
record). I guess that it was made to work this way for some reason.

The only workaround I can come up with is to include the buttons in each row
of the subform -- if you want to update or delete a record, you would have
to click the button in that row. The Add button could still be in the
footer as this should always be visible. Not a very elegant method.

However, I am sure that there must be a better solution out there
somewhere...

Thanks again for your help.
--
Cheers,
Lyn.

"Billie Kennedy Jr" <da****@orpgs.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
I had problems with some of my stuff disappearing as well. Or not even
showing up properly. Right now I use Form_Current() for setting the
default values of fields and properties for my form. Once the form is
open I have all of the active code in Form_Activate() .

When a user chooses a record the form gets updated with the information
needed. When the user chooses a new form that updates the contents of
the first form and closes the new one then the first form is updated
with the new information as well.

I do have to say that the first form is an unbound form with no active
fields. If the user wants to edit any of the information on the first
form they have to open a different form. Those options are per user
access set by a user table.
Try the Form_Activate() function for your form instead of
Form_Current().

This helped me. It may help you.
--------------
Billie
http://www.orpgs.com

Nov 13 '05 #5
Lyn
Billie,
I have solved the mystery. It had nothing to do with the controls being in
the footer, it was a general problem that only occurred in the footer in my
form.

I was setting properties ".Visible = Yes/No" which is how they are set in
the property sheet. But in VBA it should be ".Visible = True/False".
Values Yes and No are both treated as False.

Anyway, making this simple change fixed everything. I guess I was so close
to the problem I couldn't see the wood for the trees!

--
Cheers,
Lyn.

"Billie Kennedy Jr" <da****@orpgs.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
I had problems with some of my stuff disappearing as well. Or not even
showing up properly. Right now I use Form_Current() for setting the
default values of fields and properties for my form. Once the form is
open I have all of the active code in Form_Activate() .

When a user chooses a record the form gets updated with the information
needed. When the user chooses a new form that updates the contents of
the first form and closes the new one then the first form is updated
with the new information as well.

I do have to say that the first form is an unbound form with no active
fields. If the user wants to edit any of the information on the first
form they have to open a different form. Those options are per user
access set by a user table.
Try the Form_Activate() function for your form instead of
Form_Current().

This helped me. It may help you.
--------------
Billie
http://www.orpgs.com

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4208
by: PCB | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if certain fields in a table are a certain value. The buttons are adjacent to each record (i.e. - if there are 5 records, there would be 5 buttons; 10 records, 10 buttons; etc.) Here is the subroutine I've written so far: Public Sub IsButtonVisible()
30
8909
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform named "sbfrmParts" with a list of parts along with the quantity and price. I have used a text box in the subform's footer and set the control source to "=Sum(*)". I set the format to display currency. This text box is called "SubformTotal", and is visible property is set to "No". On the main form I have made another text box and set its control source to "=.Form!SubformTotal". When I enter some parts everything works...
2
2826
by: kaosyeti | last post by:
i can't get this working. in vba i tried to set visible to false in an if statement that looked like this: Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer) If IsNull(Forms!formquerybuilder.Controls!cboxdepartment) = False Then Reports!rptcontactdata.Section(GroupFooter1).Visible = False End If instead of 'groupfooter1' i tried using 'section(1)', i tried using 'saleperson footer' which is the name of the...
3
2756
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality (we're sales offices, and I'm doing things such as associate directories, commission calculations, order tracking, etc.). 2003 seems to have a few extra features, but I seem to continually run in to oddities that seem like they SHOULD work, but...
6
5127
by: Robert | last post by:
Quick question about the visible property on a form control. I have a label that displays a message if a certain criteria is met. By default the label is visible. I want access to compare a calculated field on a tab page with a control on the main part of the form: If Me.CalculatedControl = Me.MainFormControl Then Me.MessageLabel.Visible = False End If I can't figure out where to put this to make it fire. Do I need to reference the tab...
8
3230
by: kevin.vaughan | last post by:
Good Afternoon Everyone, Could someone please explain why I can't set the Subform control Visible attribute to False as below? The statement for the locked attributes work but not for the visibility. I have tried the visibility without the locked attribute in case of interference. I have also tried variations of the visibility statement and I have also tried the visibility statement in other locations, as in
1
13768
by: ramaswamynanda | last post by:
Hello, I am working on an application in MS Access. I have an employee form with an employee charges subform. the subform is supposed to be displayed in the datasheet view. I have put the labels for column headers in the form header, and the charges total in the form footer. What happens is , the header and footer are visible both on the subform and the parent form in design view, but neither appears in run mode. I have gone through every...
1
3008
by: feeman | last post by:
I have a form in access 2000 with a combo box containing names, this is linked to a sub form by the name index. on the sub form is a button that when pressed automatically enters the date into the date field. Now my problem is that when someone comes in and finds their name and presses the sign in button it is no longer visible so they can not sign in more than once that day. My trouble is that i can nor remember how to use the button...
12
3540
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9338
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.