making fields visible on subform Results

Page 1 of 6.
Results 1...20 of 102

Sponsored Links:

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

How do I do this?

Basically, I got a subform (and another field also) that are invisible. They become visible when a tick box is, well ticked.

Ok... so I have a button that does some nice code stuff. Well I have two actually....

What I want, is some code to put in the code builder bit, to make subform1 and field1 visible for the first button,

and then some more to make them invisible again for the second button, although they still have to be shown if the beforehand tick boxes are ticked, presumably the code on the tick box will sort that out. Anyone? Thankyou.

Is there any way of making fields invisible in datasheet view?

I have a subform (datasheet) with ten combo boxes on it. However, no more than six of them should be visible at any one time, based on criteria provided on the main form.

This form in tracking student attendance on a weekly basis. Each course can have up to six time slots. i.e. "Monday Morning", "Tuesday Afternoon", etc.

How can I make it so that only the time slots for which the course in scheduled show up in the datasheet?

Keagan Quilty
Kilbride, Newfoundland

I have a form, called main form, which has on subform on it. The subform is in continious form view. Basically it tracks an Out Date and an In Date. I want to make text box visible/not visible based on whether there is a value in the In date field, in the last record in the recordset. I can get the field to toggle, but I only want it to be visible if the In Date field in the last recordset is null, and if not null not visible. I have some very basic VB knowledge, so if anyone can point me in the right direction I would appreciate it.

Roeland Kim

Image posted here.

This issue relates to subforms. I have a foreign key field that I want to hide in form view. I selected "Visible = No" in the properties sheet, but the field still shows in form view. What other options are there for achieving this that do not include highly complex hand coding, since I'm not a programmer.



I have a form for the input of staff member's salary increases. On the main form I have a list box for a member of staff to be selected. As the salary details are stored in a separate table to the name details, the main form has two subforms, one for data input and one to list the salary history for the member of staff selected.

When the main form is opened, before a name is selected from the list box, the salary of the first member of staff is displayed on the subforms.

As soon as a staff member is selected, the subforms update and show the correct data.

My question is this:

Is it possible for the subforms to be blank until a name is selected from the list box or:

Is it possible for the Salary_before_update field be invisible on the subform until a name is selected from the main form list box.

I have experimented with setProperty/visible on the subform but that returns an error when the main form is loaded.

I would very much appreciate any help with this.

Thank you.

I have a form with a category field on it. The value for the category is selected from a list. Depending upon which value is selected for the category I want to hide or make visible various fields on a subform. So for example: only if the category is "Service" do I want the "Qty" field to be visible on the subform. How is this possible?

Dear All
Your help would be much appreciated once again.
I have two subforms on an unbound form.
Subform1 has a list of clients as a continuous form.
Subform2 has detail of each client and is set to invisible.
The forms are linked with a common child/parent field.
I am trying to get subform2 to become visible when I select a line on subform1.
I have tried various options in VBA for the got focus event of the form and for controls in subform1 but cant make subform2 become visible even thought the child/parent link between the two works fine to show the relevant data.
Any ideas?

Access 2010 here. Designing a database for parts inspection and quality control.

I have a peculiar issue with checkboxes in subforms. The database structure is like this:

One Main table, that is the record source of the main form and includes general inspection information. Three child tables that are in a one-to-one primary key relationship with the main table. Each child table is the record source of a unique subform. Each child table/suform deals with a certain type of inspection.

The user selects an option box (three options for three types of inspections, AQL, REW, and STD) that makes visible one subform, while hiding the other two. This option box selection also purges possible duplicate entries using "Db.Execute," and finally, this option box sets the inspection type in the main table.

	    'Example code for an AQL selection, uneeded record deletion part
    If Me.InspectionType = "AQL" Then
    CurrentDb.Execute "DELETE * FROM REWDB WHERE REWID = " & Me.MAINID, dbFailOnError

    CurrentDb.Execute "DELETE * FROM STDDB WHERE STDID = " & Me.MAINID, dbFailOnError
    End If

The idea behind the form layout/control is to be able to actively display and, if needed, modify all the old records from the main form, so DataEntry is turned off to display the older records, and turned on for entering new records under Form_Current. Form_Current also controls all the display for the older records to echo what is in the databases and re-display what the user has previously entered. (The attached image may help decipher the functionality of the database.)

The problem comes if/when the user decides to modify old records, the only thing they cannot modify, without a "3201" error "You cannot add or change a record because a related record is required in table "MainTblName"," is a checkbox in one of the subforms that controls a field in that subform's child table through VBA. It's events are quite simple and operate on the subform's table alone.

	    'The user has selected the Pass option for the AQL disposition
    Private Sub CheckPASS_GotFocus()

    Me.AQLDisposition = "PASS"

    End Sub

    'The user has selected the Fail option for the AQL disposition
    Private Sub CheckFAIL_GotFocus()

    Me.AQLDisposition = "FAIL"

    End Sub

I'm not sure if the Option group actively deleting records in the unused subforms is causing issues with record "alignment" or if the re-display of the check box doesn't "attach" itself back to the subform's database. This is one of the last hurdles I need to overcome with this database, and it seems like it could be a simple fix If I could pinpoint the problem.

I know this is quite complex and difficult to abstract well, hence why I am here, but are there any ideas or suggestions?

Thank you!

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 believe I did this before awhile ago but for some reason I keep getting an error.

I have a Mainform (frmMain) that has a Subform (frmSub). On frmSub I have 2 comboxes (strCom1 & strCom2) one is set to invisible (strCom2.Visible = No). So using the "On Open Event" of frmMain I want make strCom2 visible if strCom1 = "Read Only". Ofcourse I will also need to place the vba on the On After Update event. Below is what I have so far but doesnt work. Please can someone tell me what am I doing wrong

I get Run-time Error 2427 "You enetered an experssion that has no value"

Private Sub Form_Open(Cancel As Integer)
If Me!frmSub.Form!strCom1.Value = "Read Only" Then
     Me!frmSub.Form!strCom2.Visible = True
     Me!frmSub.Form!strCom2.Visible = False
End If
End Sub



I've only used a subform once and my brain has gone absolutely blank today so please forgive me for the following stupid question(s). I haven't set up the database yet, I'm still drawing it out on paper to see how best to set it up.

For every record we will need an Account#, Name, and Type. They Type will drive what other information we will need. For instance, if they choose "Charge", I need them to enter Action, Date, Charge Code, etc. If they choose "Payment" I need them to enter Action, Date, TCode, etc.

I'm not sure if I should make these subforms, or lump them all on one form and make them Visible or not based on the selection from the combo box.

And here's my big time stupid question. If I set up one table (Patient) with ID, Account#, Name, Type....and then set up a separate table (Charges) for Action, Date, ChargeCode, I need to have the Account# field on the 2nd table so it will know which record goes with which? Or does the ID# alone do that??

I am trying to have a label field become visible on the main form when a combo box on a linked form has a certain value. I can make it the action occur if the combo box is on the main form, but when I bring the variable of the subform into the equation, it falls apart.

I read through some earlier posts and they had links to a seemingly helpful webpage for syntax for main/subforms, but I still haven't been able to figure out the problem.

Below is the Event Procedure on the Form Load section of the main form. Main form entitled "Report Log". Subform Entitled "subfrmEntry". The combo box field on the subform is "Entry Complete" and the label on the main form I want to become visible is "labComplete"

Private Sub Form_Load()
If Me!subfrmEntry! Entry_complete .Value = -1 Then
Me.labComplete.Visible = True
Me.labComplete.Visible = False
End Sub

I have also tried:
If Me!Forms!Report_Log.subfrmEntry.Form!Entry_Complet e = -1 Then

Any help would be appreciated.


I have a continuous form showing 4 different text boxes. Three text boxes are bound to a table. 4th text box is unbound and has datasource as = [txtBox2] - [txtBox3]. I have code Me.Recalc in OnLoad event of the form.

This form has been placed as a subform in main form and height for this subform control is such that it displays 8 records (if there are more records then it provides vertical scroll bar in the subform).

What I have observed is that txtBox4 is calculated only for those records which are currently visible on the subform. For all the other records in subform which needs to be viewed using verticla scroll-bar, this control is not refreshed / calculated and when I click on this contol in Form View, it shows the calculated value

I even tried by using oncode to recalculate the fields by using code Me.Recalc on my main form OnLoad event. But still can not make it work

Do you have any suggestions?



I've got an access data project (adp) running on Access 2010.

There's a data entry form with a subform. The subform has about 50 fields set up in tabular formation. Because it's so wide there's horizontal scroll bars. The problem is, since we've upgraded from Access 2003 the subform doesn't automatically centre on the field that has the focus. The user can tab into fields that aren't visible on the screen. The can then use the scroll bar to make the fields visible but obviously this isn't ideal.
Is there a setting I need to adjust so the subform centres on the field that has the focus?



I have a main form which has about 12 pages to it. All the pages have various subforms and fields. Some are input, some are strictly information for the user.

I just added a new subform to a page and now suddenly it's showing up on ALL the pages! If I delete it from one of the other pages, it's gone from the form.

I've tried making it non-visible through code, which works until I want it visible for it's parent page, then it's back on all the pages again!

How do I keep it appearing only where I want it when I want it to appear? It seems like such a small thing, but it's driving me crazy!

Thanks for any suggestion y'all are willing to give. I do appreciate it.


How would I make a field on a subform visible by what is selected in a combo box on the parent form?

Any help is greatly appreciated.

I'm using the following code to show a record on the parent form selected from the subform.
How can I code this so that unless a record is selected by clicking on the subform, certain fields on the parent form will not be visible? Then when a record is selected all fields are visible.

Private Sub BreedType_Click()
Dim rst As DAO.Recordset ' make sure DAO is referenced
Set rst = Me.Parent.Form.RecordsetClone
rst.FindFirst "DogNumber = " & Me.DogNumber
Me.Parent.Form.Bookmark = rst.Bookmark
Set rst = Nothing

End Sub


I have just spent an hour trying to work out why I can't make a field invisible on my subform (in datasheet view).

I was working from an example that one of the forums members sent me (which I think was in Access 97 format - I use 2002) where he was able to do this.

I then searched the net and found this:

"your subform is in Datasheet view, and the Visible
property of controls only applies when the form is in
Single Form View or Continuous Forms view. The
controls displayed in Datasheet view really aren't the
same controls, and the regular formatting properties don't
apply to them."

Is this then a difference betweent he two access versions? Or am I missing something?

Thanks for any help.


Can someone answer some simple questions for me please?

From the main form, what is the syntax to set the focus to a field in the subform?

How do I hide or make visible a field on the subform during the operation of a procedure on the main form?

Does every field on the subform have to be linked to the main form?

Can I test for a value in a field in the subform?

Does a NotInTheList test work on the subform?

Page 1 of 6.
Results 1...20 of 102