Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filter breaking .AllowAdditions = False (A2k SP2, DAO)

    Hi All,
    Sorry. A little clarification is needed (it is late) and some code I forgot to paste.
    The AllowAdditions property is set to false AFTER I lay and fill out the subform for data entry per the now added code.
    I have also tried to limit the RecordCount in the OnCurrent event of the subform, but the filter blows by that as well.
    ************
    Dim db As Database
    Dim rst As Recordset
    Dim rstList As Recordset
    Dim strTable As String

    Set db = CurrentDb()

    strTable = "tblTest2point1_List"
    Set rstList = db.OpenRecordset(strTable)
    Set rst = Me!sbfrmProbeData2point1.Form.Recordset

    'add the test list into the recordset of the sub form Lab Probe Data
    'it is necessary, when adding a record to a subform using code,
    'to expressly add the Foreign Key; i.e. Me!IGICaseNumberDataDetailsPKID
    With rstList
    Do Until .EOF
    With rst
    .AddNew
    !IGICaseNumberDataDetailsPKID = Me!IGICaseNumberDataDetailsPKID
    !TestRun = "2.1"
    !ProbeLocus = rstList![ProbeLocus]
    .Update
    End With
    .MoveNext
    Loop
    End With

    Me!sbfrmProbeData2point1.Requery
    Me.pg2point1.Visible = True

    With Me.sbfrmProbeData2point1.Form
    .RecordsetClone.MoveFirst
    .Bookmark = .RecordsetClone.Bookmark
    End With

    Me.sbfrmProbeData2point1.Form!txtWeekNumber.SetFoc us
    Me.sbfrmProbeData2point1.Form.AllowAdditions = False
    ************
    Thank you.
    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    filter breaking .AllowAdditions = False (A2k SP2, DAO)

    Hi All,
    I've got 4 continuous subforms for Lab Data entry, each on a Tab. All use the same query as their recordsource. As a tab is chosen, the subform becomes visible and has 3 (out of 16) fields per record filled in. The recordcount of the subform is predetermined by the number of tests required and therefore I have the AllowAdditions property set to false. (The number of tests required for TestRun1 [for the subform on Tab1] requires 9 tests, TestRun2 needs 8, TestRun3 and TestRun4 need 4. See my post, <!post=142046,142046>142046<!/post> and the subsequent answers for a bit more background.) This all works fine. (Post edited by WendellB to activate link to previous post)
    However, since all 4 subforms are based on the same query, all the data entered from any of the subforms is visible in all the rest. So I tried to set filters on each of the 4 subforms. That limits each subform to its own data, but then I get a blank record, ready to add new data, at the end of the subform. I'd like that blank record NOT to appear.
    I've placed filters in the OnCurrent of the mainform and of the subforms. I've placed criteria in the underlying query. Every place I've tried to allow both limiting the recordsount AND suppressing that new blank record hasn't worked.
    Would someone please enlighten me as to if this can be accomplished and then as to where I need to place my code? Or am I going to have to change my setup a little and add 3 more tables.
    Thank you.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

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

    Re: filter breaking .AllowAdditions = False (A2k SP2, DAO)

    Hmmmmm - subforms generally are used where both the main form and the subform is bound to a table or a query (which may be stored as a SQL String in the form/subform). If you already have 4 separate subforms, why not make each have it's own unique data source? If I understand your code correctly, that is the code that creates all of the test cases, and not the code you mention in the OnCurrent event of the subform. Given that you should be able to create queries with the appropriate criteria to limit records displayed to those that should show up on a given tab. I don't think I have enough info to tell you what the queries should look like, but if you post a bit more detail on what a given tab should be limited to, I'll take a stab at it.
    Wendell

  4. #4
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filter breaking .AllowAdditions = False (A2k SP2, DAO)

    Hi Wendell and Thank You,
    You said:
    >If I understand your code correctly, that is the code that creates all of the test cases, and not the code you mention in the OnCurrent event of the subform.
    Yes that is correct.
    So, after the test cases are created (entered), I should then 'requery' using a query as my subform RecordSource to limit the records?
    Per my first post (142046) I want to give the user the impression that they have a single form rather than the continuous form I am using, which includes suppressing the last 'empty' (for a NewRecord) record. I am also going to 'rearrange' the RecordSource for the main form AND the subforms and see if that lends itself to a better layout.

    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

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

    Re: filter breaking .AllowAdditions = False (A2k SP2, DAO)

    <<So, after the test cases are created (entered), I should then 'requery' using a query as my subform RecordSource to limit the records?>>

    Yes, I think that should work - and your method of tricking the user into thinking they are entering one record when in fact they are entering several should work as long as you turn off record navigation and the dividing lines. Also be sure that the subform Cycle property is set to Next Record.
    Wendell

  6. #6
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: filter breaking .AllowAdditions = False (A2k SP2, DAO)

    Thank You Wendell,
    I've also changed my table & query design a bit (nothing major) and as of the moment, things seem to be set. Ah, but only time will tell. <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

Posting Permissions

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