Results 1 to 11 of 11

Thread: Sub Form (2003)

  1. #1
    Star Lounger
    Join Date
    Feb 2008
    Location
    philadelphia, Pennsylvania
    Posts
    72
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Sub Form (2003)

    FYI - I do not know VB, so depend on the wizards and "preset" macro options in Access...
    I want to do a search on a form, then use a subform or control to open a new form that is tied to the search record. I also want to lock the record the search brings up, so changes cant be made to that table - I dont know how to set the searched record to locked and still allow the subform to add data... If I set the properties on the searched record to snapshot, or dont allow adds, the subform (although set to add new records) will not be displayed. If I do the second form as a control, I cant tie it to the searched record. Sorry if this is confusing, I am not sure how to explain the problem.... Any thoughts would be appreciated!

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

    Re: Sub Form (2003)

    Do you always want the main form (in which you search) to be read-only, or are there situations in which the users will be allowed to edit records?

  3. #3
    Star Lounger
    Join Date
    Feb 2008
    Location
    philadelphia, Pennsylvania
    Posts
    72
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Re: Sub Form (2003)

    I want the searched record to be read only
    Thanks

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

    Re: Sub Form (2003)

    Try setting the Allow Edits property of the subform to No. User will not be able to edit existing records, but they can still add new records.

  5. #5
    Star Lounger
    Join Date
    Feb 2008
    Location
    philadelphia, Pennsylvania
    Posts
    72
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Re: Sub Form (2003)

    Great -I will give it a try!

  6. #6
    Star Lounger
    Join Date
    Feb 2008
    Location
    philadelphia, Pennsylvania
    Posts
    72
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Re: Sub Form (2003)

    I tried that, but in my scenario, there is data on the initial record, and the subform was supposed to allow data to be entered - but since there was no data on the subform for that record already, the subform will not even display...?

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

    Re: Sub Form (2003)

    You should be able to add a new record in the subform, unless you also set Allow Additions to No.

    Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  8. #8
    Star Lounger
    Join Date
    Feb 2008
    Location
    philadelphia, Pennsylvania
    Posts
    72
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Re: Sub Form (2003)

    It was too hard to strip it, so I copied the two forms and sub form to a sample... I hope I went far enough.... the first form (biosub) has the subform on the form - but you see the form is blank, so you cant enter new data... the second form (tab example) has a control, and it lets you add data, but then will not save because it thinks you have not entered the a number, although the sub form is tied to the a number... and if you add the a number field to the form, it does not auto fill from the main record.... I am sure I am missing something silly, but it has me
    Attached Files Attached Files

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

    Re: Sub Form (2003)

    I was wrong, apparently it isn't possible to add records to a subform is the main form has Allow Edits set to No. I don't understand this restriction, but that's the way it is.

    In the attached database, I've used a separate form instead. The user has to click a button to open the form.
    Attached Files Attached Files

  10. #10
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sub Form (2003)

    Presumably that is because the sub-form control is 'disabled' from editing.

    If all of the controls on the main form were locked (except the subform control) and the AllowEdits was set to Yes you could still add records to the sub-form.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

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

    Re: Sub Form (2003)

    That should work, but then yo'd need code to unlock the controls when the user wants to add a new record in the main form, and lock them again afterwards.

Posting Permissions

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