Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subform in form view, not datasheet (Access 2000)

    I have created a subform using the wizard. When I leave design view, it shows in datasheet view. How can I get the subform to be in form view - not datasheet view? Thank you.

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Open the subform by itself in design view and set the property for the form to be either continuous or a single record depending on your needs. (note that it can also be done with the main form in design mode - you have to select the subform (not the subform container) and then display the properties for the subform.)
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform in form view, not datasheet (Access 2000)

    Open the subform in design view and set the default view to Single Form or Continuous Form as desired.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Thank you. It worked. When the main form displays I show the Customer information. I then created a command button to open form #2. On form #2 I display the policy number and the customer number. Below that data is the subform. In the subform I list the additional insured information of the customer. Question, when the comman button is selected to open up form #2, how do I get the policy number to synch with the policy number on the main form?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Something like this:

    Private Sub cmdOpenForm2_Click()
    DoCmd.OpenForm FormName:="frmForm2", WhereCondition:="[PolicyNumber]=" & Me.[PolicyNumber]
    End Sub

    where:
    cmdOpenForm2 is the name of the command button on the main form.
    frmForm2 is the name of form #2.
    PolicyNumber is the name of the field containing the policy number.

    I have assumed that PolicyNumber is a number field. If it is a text field, change the above to

    ..., WhereCondition:="[PolicyNumber]=" & Chr(34) & Me.[PolicyNumber] & Chr(34)

    Chr(34) is the double quote ", text values must be enclosed in quotes.

  6. #6
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Thank you. Earlier I created a report where I displayed the customer information grouped by policy number, then the policy year and the data for that year. I want to re-create this same data on the subform. Form # 2 states the Policy Number and the Premium Year is a combo box. In the subform I now want to display the data by Premium Year. Basically, if the Premium Year changes in the combo box, I want the data in the subform to be in synch with the Premium year. How can I do this? Thank you.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    By far the easiest way is to set the Link Master Fields and Link Child Fields of the subform correctly.
    - Open form#2 in design view.
    - Click once on the subform (don't click a second time, that would select something within the subform)
    - Activate the Data tab of the Properties window.
    - In Link Child Fields, enter the name of the premium year field in the subform.
    - In Link Master Fields, enter the name of the premium year field or combo box on form#2

  8. #8
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    St. Charles, Illinois
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Thank you. I tried this and I realize I need to link the Policy Number and the Premium Year of form #2 to the main form. When I followed your instructions the Premium Year matched, but now one customer has all the data for that Premium Year. What should I do? Thank you.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform in form view, not datasheet (Access 2000)

    Change the code from my reply higher up in this thread from

    DoCmd.OpenForm FormName:="frmForm2", WhereCondition:="[PolicyNumber]=" & Me.[PolicyNumber]

    to

    DoCmd.OpenForm FormName:="frmForm2", WhereCondition:="[PolicyNumber]=" & Me.[PolicyNumber] & _
    " And [PremiumYear]=" & Me.[PremiumYear]

    with, of course, the appropriate names substituted. I don't understand, however, why you would have a combo box for Premium Year on form#2 if it is linked to the year on the main form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •