Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    ahh, wait!! it just dawned on me: jeez, I am slow sometimes. the item IS being added, but the requery is causing combo31 to be empty, so it isn't showing that employee's list (gee wiz, sorry I didn't get that at first)



    OK, so now my question is how do I get the employee to stay in combo31 while the sub form requeries or refreshes to show the new item? is that possible?

    (again, sorry)

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, the combos go blank because you went to a new record. Fields in a new record start out blank unless there's a default value. Combo38 doesn't go blank because it's unbound (though I would probably set it blank when going to a new record). What do you expect the fields to show for a new record, other than blank?

    On the links, it fine to use them to only display records for the person displayed, but requerying the subform won't matter if the combo is blank (on a new record), as the subform will also be empty. You say you only want to see records for the displayed, and that's exactly what it's doing. If I put the master child links back (I took them out to test the requery, which worked fine), as soon as you select a person in the combo their records show up.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Sorry, we were posting at the same time. To put the same person back, this is one way:

    Code:
        Dim varPerson             As Variant
        
        DoCmd.RunCommand acCmdSaveRecord
        varPerson = Me.Combo31
        DoCmd.GoToRecord , , acNewRec
        Me.Combo31 = varPerson
        subAttempt.Requery
    Here's another:

    http://access.mvps.org/access/forms/frm0012.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Quote Originally Posted by pbaldy View Post
    What do you expect the fields to show for a new record, other than blank?
    I can guarantee that I gave it absolutely no thought at all.




    believe it or not almost the same thing occurred to me right after I posted that previous comment, although I was working on this:

    Private Sub Command35_Click()
    Dim comboVar As Integer
    comboVar = [Forms]![frmAttempt].[Combo31].[Column](1)
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.GoToRecord , , acNewRec
    ' subAttempt.Requery
    [Forms]![frmAttempt].[Combo31].[Column](1) = comboVar
    End Sub

    but I hadn't had a chance to test it yet, so I didn't know if it would have worked or not

    is it better to use a string variable for the combo, or to use the bound column of the combo box, or does it even matter?

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'd use the data type of the bound column (typically Long or String). I used Variant because I was lazy and in a hurry, but it did work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    YES, IT DID!!!
    what you gave me works quite well.

    thanks again for all the help

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 07-14-2015, 07:48 AM
  2. Replies: 6
    Last Post: 08-22-2012, 03:24 AM
  3. Replies: 4
    Last Post: 03-14-2012, 10:08 AM
  4. Replies: 2
    Last Post: 12-07-2011, 02:51 AM
  5. Replies: 2
    Last Post: 05-11-2011, 02:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums