Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order form with subform problem (97)

    What if you invert the sequence of the code and add a line to set the focus to the subform to go to the last record in the subform :
    <pre>Private Sub Form_Open(Cancel As Integer)
    Me.sfrmOrderDetails.Requery
    Me.sfrmOrderDetails.Setfocus
    DoCmd.GoToRecord , , acNewRec
    Me.DatePlaced = Date
    End Sub</pre>

    Or do I miss something ?
    Francois

  2. #2
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order form with subform problem (97)

    The subform contains the details of the order, such as individual items.

    The main form is the order header info, such as customer, address, etc...

    I suppose I could go to a new rec on the subform, but I shouldn't have to, should I?

    I added a link to the database in the firt post if you are interested...
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order form with subform problem (97)

    Francois,

    your idea worked perfectly.

    I don't know WHY it worked or why it wasn't working to begin with, but thank you!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  4. #4
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Order form with subform problem (97)

    I have a form for an order to be entered in. The user fills in the details and then clicks Done.

    Done does the behind the scenes action just fine.

    When the user opens the form again, however, the subform shows the details for the first order.

    My Form_Open even of the Order form looks like this:
    <pre>Private Sub Form_Open(Cancel As Integer)
    DoCmd.GoToRecord , , acNewRec
    Me.DatePlaced = Date
    Me.sfrmOrderDetails.Requery
    End Sub</pre>


    Any ideas? I'm willing to post the database if necessary...This has me stumped.

    Thanks!

    <edit>
    Removed the database...
    </edit>
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order form with subform problem (97)

    A requery brings always the cursor to the first record.
    If you go to an new record and then requery, you're going back to the first record.
    The trick is simply to requery first and then go to the new record.

    If you want to go to the last record in a subform, you have first to set the focus to the subform. If you don't, you'll be going to the new record in the main form.
    Francois

Posting Permissions

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