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

    Form moving to wrong record (A2k3 SP2)

    Hi All,
    In the attached db, if you open popfrmDepartmentInfo and enter a new value into the College Abbreviation combobox (cboCollege), the NotInList event triggers and opens the new data entry form popfrmNewCollege. In the OnOpen event of popfrmNewCollege, the new value is saved into tblCollegeName_List and the form *should* move to that new record (LastModified). It does not do that, but if you roll the mousewheel you can find your new entry. However entering a new department (into an existing college) into the Department Abbreviation combobox (cboDepartment), using popfrmNewDepartment works just fine. I can't see why the one form will move to the LastModified as it should and the other won't and am cross-eyed from trying. <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16> <img src=/S/eyeout.gif border=0 alt=eyeout width=15 height=15>
    Thank you.
    Attached Files Attached Files
    <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
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form moving to wrong record (A2k3 SP2)

    You don't need to use a recordset, you can enter the value directly in the form.

    - Set the Data Entry property of popfrmNewCollege to Yes
    - Use the On Load event instead of the On Open event:

    Private Sub Form_Load()
    On Error GoTo ErrHandler

    Me.CollegeAbbrev = Me.OpenArgs

    ExitHandler:
    ...

    - You can do something similar for popfrmNewDepartment.

  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: Form moving to wrong record (A2k3 SP2)

    Hi Hans,
    Sorry for the delay.
    Of course, your suggestion, which I have used before, works fine. Thank you very much.
    I am curious, however......I've used this NotInList coding for, geez, 5 or 6 years now (I cribbed it from a NotInList routine from Andy Baron) and I've haven't seen it not go to the proper record (unless I've done something wrong and I can't see anything I've done or not done here - though that remains a distinct possibility). So if anyone has a correction/explanation/tweak I would certainly like to hear it.
    Thank you again Hans.
    <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: Form moving to wrong record (A2k3 SP2)

    It would have worked if you had used the On Load event of the form, even with the recordset code. You cannot always use the On Open event because this occurs before the first record is loaded.

    However, the recordset code is serious overkill for this situation, since you can simply set the value of the text box.

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

    Re: Form moving to wrong record (A2k3 SP2)

    It would be my bet that I've got some more "misplaced" coding in events and some of my "templates" will have to change. <img src=/S/doh.gif border=0 alt=doh width=15 height=15>
    Thanks for the information Hans.
    <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
  •