Make field on subform not visible

I have a form with a subform. I would like to make a field on the subform not visible if a field on the primary field is null. Can anyone help? Thanks.

Post your answer or comment

comments powered by Disqus
I have a form (frmMyTasks). I have two subforms on the form (tvMyTasks and sfrmMyTasks). These are always visible and there are no problems. I have a third subform (QSubform) which is made visible by a button on the form (frmMyTasks). No problems there. I have a button on the subform (QSubform) which I would like to make the form (QSubform) not visible again.

QSubform is the name of the control on my main form (frmMyTasks) which houses the form subFrmQuestions.

Code behind the button on my subform: I have tried me.qsubform.visible=false with no luck. I have tried forms!subFrmQuestions!QSubform.visible=false with no luck

Can someone please help me.

I have used a SELECT UNION in order to get round the fact that Access truncates Memo fields.

My query reads:

SELECT DISTINCT [surname] & " " & [forenames] AS fullname, Answer.grade, Answer.[grade mark], Answer.[actual mark], Answer.[penalty type], Answer.[penalty percentage], [Project Question].[weighting in project], Project.[weighting in module], [actual mark]*[weighting in project]*[weighting in module] AS contribution, Student.[student number], [Enter Student N°; leave blank to show all] AS Expr1, Student.surname, Student.forenames, Team.[team name], Project.[project code], Project.[weighting in module], Question.[question code], [Project Question].[question number], [Project Question].[question part], [Project Question].[max mark], [Project Question].[weighting in project], Answer.[actual mark], [Project Weighting].type, [Project Weighting].[SumOfweighting in module], Project.[project type], Answer.[answer nr]
FROM [Project Weighting] INNER JOIN ((Team INNER JOIN (Question INNER JOIN (Project INNER JOIN ([Project Question] INNER JOIN Answer ON [Project Question].[project question SID] = Answer.[project question SID]) ON (Project.semester = [Project Question].semester) AND (Project.yr = [Project Question].yr) AND (Project.[project code] = [Project Question].[project code]) AND (Project.[module code] = [Project Question].[module code])) ON Question.[question code] = [Project Question].[question code]) ON (Team.trigramme = Answer.trigramme) AND (Team.semester = Answer.semester) AND (Team.yr = Answer.yr) AND (Team.[team number] = Answer.[team number]) AND (Team.[group number] = Answer.[group number]) AND (Team.[module code] = Answer.[module code])) INNER JOIN (Student INNER JOIN [Team Student] ON Student.[student number] = [Team Student].[student number]) ON (Team.trigramme = [Team Student].trigramme) AND (Team.semester = [Team Student].semester) AND (Team.yr = [Team Student].yr) AND (Team.[team number] = [Team Student].[team number]) AND (Team.[group number] = [Team Student].[group number]) AND (Team.[module code] = [Team Student].[module code])) ON [Project Weighting].type = Project.type
WHERE (((Student.[student number])=[Enter Student N°; leave blank to show all]) AND (([Enter Student N°; leave blank to show all]) Is Not Null)) OR ((([Enter Student N°; leave blank to show all]) Is Null))
ORDER BY [surname] & " " & [forenames], Project.[project code], [Project Question].[question number] UNION select news as newz, null, null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null, null, null , null from control where sid = 1;

The field newz is not visible when I use that query as the record source in a report - that is, the field list includes fullname, team number etc. but not newz (or news).

What am I doing wrong, please? Thanks for your help.

Below is the code I have to populate an unbound field on my form.
It worked great until I put the field into the subform. This code is in
an AfterUpdate Event on the main form and I need it to populate a
field on a subform. I do not know how to add the Subform to the code!
I know this is probably something simple but need help.

The Subform name is:

	Me.Method10 = DLookup("[Method]", "ReplenishMethodTbl", "[PullSeqCode] = '" & DLookup("[Pull_Seque]",
"MainEntryQrySelectSub1") & "'")

I have just created a form with a subform. The subform is linked to the main form via a field 'TAG'.

The main form has a listbox of cows available for being AI'd or Bulled. When a cow is selected in the listbox it brings up its own history in the subform.


The TAG field on the 'next record' is populated with the value 1148 on every cow and i can't work out where it has come from or what it is doing there !!!! Its almost funny but now its beginning to annoy me that i can't find out where it is coming from.

The value does not relate to anything in any table & the only thing i think it can be is a PK_ID from one of the cows but i haven't a clue how it is getting there or how to get rid of it.

Would anyone be kind enough to view this sample db and point out what is most likely staring me in the face

I have a subform in a form and I want it to remain closed or not visible until opened by a command button. How do I do this.

I am trying to update a calculated value form 2 fields on my subform. Using the formula below. How or where should I put this code? I had it on the after update event, but it would was trying to calculate and not allowing me to tab out of the field.
As you can see, I need the field "Difference" which is not editable to show the difference between the 2 other fields.

Me.Difference = [SetReOrderLevel] - [OnHand]

I have a report that the main part of the report prints from a query for items shipped on a certain date. Some of the reports (ship dates) will need to have a note section where the user can enter notes for that report. I have made a section of the input form that enters this note data into a memo field of another table. Some reports will have notes in the note section and some will not.
Here’s the problem; the note section is visible when I look at it with report view but, when I select print pre-view to PRINT the report the memo section is not visible. It’s not visible on the screen or on the printout.
As of now I have an unbound text box on the report that I write the note information into.
Any help or suggestion will be very much appreciated.
Thanks in advance.

(I thought this was solved, and it's not so I'm re-posting)...
I need to set a date field on a sub form to a date variable.

- The parent form is called: "f_LCA"
- Have sub_form called "f_Advertise subform"

- Field on the sub_form called "PostedDate" (date, short)

- Have a variable called "NewPostedDate", (dim as date), e.g., 07/19/2010

I tried the following things:

1) me.PostedDate = NewPostedDate (got error message)

2) me.PostedDate = (# NewPostedDate #) (got error message)

3) me.PostedDate.DefaultValue = NewPostedDate (no error message, but
PostedDate field did not display the new date)

4) me.PostedDate.DefaultValue = NewPostedDate (no error message, but
PostedDate field did not display the new date)

5) tried putting NewPostedDate variable as the default value in the field's property. It translated the entry as "NewPostedDate"

Your help would be greatly appreciated!

Hi All,

I have a form with a value field on it. I also have a subform on the main sheet. When I update the field on the main form, I want a field on the subform to equal 50% of the value.

I'm sure this is simple, but I've tried everything and can't for the life of me get this to work.

Can anybody help please?

Many thanks

Im sure this is a common problem, I had a nasty shock when I discovered that calcualted fields (from a query) in my subforms are NOT stored with the database though the control source is a table field they are not bound to a table.

What are the most popular ways to solve this?

Easier the better

Hi -

I have 2 subforms (sub 1 and sub 2). I would like to link a field that is populated on sub 2 and have the value appear in a read only field on sub 1).

How can I do this?


I want to store the value of a field on a subform into a string.

What is the syntax?

I have strStatus = Me.subform.controlname

But this doesn't work!



I have two tables, one for Sales Equipment which has a primary key of SalesGoodsID (auto generated) which has an one to many relationship with a table called Testing (field name relationship exists with is fk_SalesGoodsID). The primary key in table Testing is PATTESTID which is entered by data entry user.
I have created a form with a subform. However what I want to be able to do is search on the main form for a field on the subform namely PATTESTID and after enterting the PATTESTID have the main form updated with the details relevant to the PATTESTID.
If anyone has any ideas I would be very grateful, I am very new to designing forms on Access.

I need to choose a value, which will be a number from one field (TaxRate) and have it update a field on my subform which also is a number (TaxRate)

TaxRate set subform TaxRate to value chosen

main form is named AddProducts and subform is named AddProductsSubform Attached Thumbnails     Last edited by burrina; 11-02-2012 at 12:40 PM. Reason: Explain and post pics Reply With Quote 11-02-2012, 08:54 PM #2 Rod Expert Windows 7 32bit Access 2007 Join Date Jun 2011 Location Metro Manila, Philippines Posts 658 Do you want to update a specific row in the subform or all rows in the subform?

Are the fields in a subform row locked or disabled?

Hi all. I’m having a problem with questionnaire I’m building. Technically I think this is a problem with a form. But I’m posting it here because I’ve got a feeling the solution will lie in code. The questionnaire is built as a form containing a question with a continuous subform listing a number of subquestions. For example:

What foods do you like? (check all that apply)
Other (specify)

In the above example I have check boxes to record the users responses. However, I’d also like to include a field for the users to enter text for the “Other” response. So, my question is this. Can I make a field visible for a single record on a continuous form? If so, how? If not, does anyone have an alternate idea? Thank you in advance for your assistance.


I've tried this code. The result is the field is not visible until I goto the "Other" record. At that point it becomes visible in all records.

Private Sub Form_Current()
If InStr(1, Me.txtSubQuestion, "specify") > 0 Then
Me.txtResponseNote.Visible = True
Me.txtResponseNote.Visible = False
End If
End Sub

[This message has been edited by Abby N (edited 01-18-2001).]

I have a main form showing details of a project, with a subform in continuous view, showing details of people who are working on it. One of the fields on that subform is PI_Email_Address.

I have set the Display As Hyperlink property to Always and I assume I now need to set the Hyperlink Address using VBA.

In the source table, the field type is text, rather than hyperlink, because the tables are not local. In fact this database uses several SharePoint lists which are linked as tables. I don’t know whether that complicates things much.

I have done something similar before in another database, although in that case the email field was on a form in single view rather than continuous view. Anyway, using that approach, I came up with the following and inserted it on the Current event of the form that’s being used as a subform

	Private Sub Form_Current()
'EmailIcon is a small image of an envelope inserted on the form

If Not IsNull(Me.PI_Email_Address) Then
   Me.EmailIcon.HyperlinkAddress = "MailTo:" & Me. PI_Email_Address  
   Me.EmailIcon.Visible = True
   Me.EmailIcon.Visible = False
End If
End Sub

However, there are four records on my first subform of which only one has a completed email address. But the EmailIcon is visible on all four. And when I click it nothing happens anyway.

Would that code work if I attached it to a different event, or maybe even to the parent form? And/or do I need to add some code to the click event of the EmailIcon itself?

Ideally, I would like to be able to just click the email address as it’s displayed and not bother with the EmailIcon at all, but I don’t know if that’s possible.

The fact that the icon is visible on all four records leads me to suspect this is caused by having the form in continuous view. But I’d really rather not have to change that!



Folks -
Thanks so far for all the assists out there ... Am learning quite a bit and have been using this forum as a reference to get through some issues.

Here's one I cannot quite figure out.

I have a form [Details] which has a Subform [PaymentInfo].
the fields on the [PaymentInfo] Subform are all set to "visible=no"

On the Details form, I have a field [FeeElection] which can be one of three percentages. After I enter the percentage in this field, I want certain fields on the subform to become visible, depending on the value of the [FeeElection] field.

This is the code I put in the "On Lost Focus" for the FeeElection field (which isn't working):

Select Case Me.FeeElection
Case 0.5
[PaymentInfo].[Field1].Visible = False
[PaymentInfo].[Field2].Visible = False
[PaymentInfo].[Field3].Visible = True
Case 0.4
[PaymentInfo].[Field1].Visible = True
[PaymentInfo].[Field2].Visible = False
[PaymentInfo].[Field3].Visible = True
Case Else
[PaymentInfo].[Field1].Visible = False
[PaymentInfo].[Field2].Visible = False
[PaymentInfo].[Field3].Visible = False
End Select
End Sub

I am sure it is a syntax error on my part (probably trying to reference the field on the subform).

Can someone out there set me straight?

R. Fisher


I have a problem.

I have created a form with a subform.

When opening the main form I would like to create a macro that is able to set the property visible/not visible for a certain field if a certain condition on another field is satisfied. I Have Office 2010 and with the macro editor I'm not able to make it work.Can you help me out writing the text as in the macro editor?

Here below the example:

Main form name: FORM_1
Subform name: SUBFORM_2

Subform field: FIELD_ABC
Subform field: FIELD_123
Subform field: FIELD_CHECK

Opening the form FORM_1, the macro must show the field FIELD_ABC and hide the field FIELD_123 only if FIELD_CHECK is equal to "TEXT OK" ...and the macro must hide the field FIELD_ABC and show the field FIELD_123 only if the field FIELD_CHECK is equal to "TEXT WRONG".

Ps: I would like to use the same macro on a report.

Thank you!!!

Is there a way to make a field on a report visible or not depending on the current date?

Hi All,

I'm kinda stuck on something. I'm trying to make fields either visible or invisible based on criteria chosen in a form.

I have a table with five fields, call "Sign Selection"
Field 1 is called "Window banners"
Field 2 is called "Theme pennants"
Field 3 is called "Exterior banner"
Field 4 is called "Entrance card"
Field 5 is called "Pole sign"
All fields are a 'yes/no' type

I have a report that will generate a list of retail stores from a query called "Store attributes" which shows how many of each sign element each store should receive.

However, when distributing the signs, sometime I'm only shipping two out of the five types. I know that I can go into the design of the report and uncheck certain fields so they don't show up, but I need to make this more user friendly. I'd like to control this with check boxes on a form, so my user will open the form, check off the appropriat types of signs. Then run the report that will show only those sign types.

Any ideas?
Let me know if my question needs more clarity.



Is there a way to make a field on a form visible or not visible dependant on repsonses made in a table.

I want a button for admin tools to appear when the admin user is logged in.

	Private Sub Form_Load()
If Tbl_Users_EngineerID = "Administrator" And Tbl_Users_fldLoggedIn = True Then
Me.cmdAdminTools.Visible = True
Me.cmdAdminTools.Visible = False
End If
End Sub

I have the above code but it does not work.
Any help appreciated.

I have a form that has several tabs. Some of the tabs use subforms. The other tabs are just displaying data related to the main table. On the open of the form I am performing some security checks for making certain tabs visible or not. Now what I want to do is on one of the tabs that is just displaying data from the main table I want to conditionally disable certain fields.

So I'm trying to figure out how to reference those fields on that tab.

The tab is called "Preferences", so I currently have in my code

Me.Preferences.Visible = False

What I want to do is allow the user to have access to the tab, but not be able to change any field values. So I must set Me.Preference.Visible = True, but then how do I set the fields to "Locked" or "Disabled".

Thanks for any assistance in this manner.


hi all!

i need some ideas here from u, pls help me. i have a table listing all the access rights each user has. the table contains the module name which they have access to and the fields which they see on the form. For example, for user adam, he can access the invoice module but only the invoice number, invoice date and invoice amount fields. the rest of the fields like the person who prepared it and approved it cannot be accessed. so for user adam the field


i have a form where the invoice details are viewed. in the form load event, i actually hard code the above like this:

Me!PreparedBy.Visible = False
Me!ApprovedBy.Visible = False

i didn't want to hard code it, in case, the VisibleFields might change later. so i tried to run through all the fields in the recordset (btw, the form is bound to the table) and search in the VisibleFields string for fields that are not there like this:

strVisibleFlds = "InvoiceNumber,InvoiceDate,Total"
intFldCnt = Me.Recordset.Fields.Count
For intX = 1 To intFldCnt
strFldName = Me.Recordset.Fields(intX - 1).name
intPos = InStr(strVisibleFlds, strFldName)
If (intPos = 0) Then
Me!strFldName.Visible = False
End If
Next intX

ok, strVisibleFlds is not hardcoded, it's taken from the table where each user access rights are kept. now, the problem is that i just can't access a field with "Me!strFldName.Visible = False". the object will not be found. is there any way around it?? or is there any other way to do it so that there's no need hard code??


Hey everyone. I have a subform that shows fields but want to hide them or not make them visible. Can this be done? How. Thank you.

Not finding an answer? Try a Google search.