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

    continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    I am trying to set the recordsource of a continuous subform to a certain number of records and enter 1 piece of data into each of the records.
    During data entry, the user picks 1 to 4 of 4 option buttons corresponding to 4 separate lab test runs on a sample. TestRun1 has 9 separate tests, TestRun2 has 8, TestRun3 and TestRun4 have 4. (Each tests' data points, however, are formatted the same and are entered into a single table, tblProbeData.)
    When an option button is pressed, a Tab becomes visible with whichever TestRun's subform has been chosen. I would like the subform recordsource recordcount to be limited to the number of tests (no problem there) and have 1 item of data (the specific test name) "pre-entered" as it were, so that the User has, what looks like to them anyway, a single form view in which to enter data.
    I know I can enter this data using a single form subform (but that's not what the User/Customer wants to see).
    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

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    I would initially create a record for each test in the subform. Then set the testname's control properties as such: enabled=no, locked=yes. The user will then see what apparently is a single form listing all the tests, and tabbing will move from one test result to the test result on the next line.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

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

    Re: continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    Hi Marty,
    Thanks.
    Here's what I've done. It sets the test names I've listed in a table and adds the records to the subform, then makes the tab visible. In the OnCurrent event of the subform I've placed code to limit the recordcount to a predetermined number, the recordcount of test names.
    **************************
    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!sbfrmLabProbeData.Form.Recordset

    With rstList
    Do Until .EOF
    With rst
    .AddNew
    !IGICaseNumberDataDetailsPKID = Me!IGICaseNumberDataDetailsPKID
    !ProbeLocus = rstList![ProbeLocus]
    .Update
    End With
    .MoveNext
    Loop
    End With

    Me!sbfrmLabProbeData.Requery

    Me.pg2point1.Visible = True

    Me.sbfrmLabProbeData.Form!txtWeekNumber.SetFocus
    **********************
    Now, could you please point me in the direction of how to set the focus to a given textbox (in this case txtWeekNumber) in the 1st record, rather than that given textbox in the last record?

    Thank you very much for your help.

    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

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

    Re: continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    I would have expected that the first record in the subform to be the current record after requerying the subform.
    Try inserting the following lines just before you set focus to the text box:

    Me!sbfrmLabProbeData.SetFocus
    RunCommand acCmdRecordsGoToFirst

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    Prior to this line in your code:<pre> Me.sbfrmLabProbeData.Form!txtWeekNumber.SetFocus</pre>

    All you need are these lines:<pre>With Me.sbfrmLabProbeData.Form
    .RecordSourceClone.MoveFirst
    .Bookmark = .RecordSetClone.BookMark
    End With</pre>

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  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: continuous subform records with piece(s) of data ' (A2k, SP2, DAO)

    Hi Marty and Hans,
    Thank you very much.

    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
  •