Results 1 to 9 of 9
  1. #1
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60

    Combo box requery

    Hi



    Could anyone help me with this please? I have combo box that is causing Access to complain.

    myFulfilledBy = "Select * from CPReqs where ([FulfilledBy] = " & Me.cbo_FulfilledBy & ")"
    Me.sfrm_CPReqs.Form.RecordSource = myFulfilledBy
    Me.sfrm_CPReqs.Form.Requery

    the combo is called cbo_FulfilledBy but access complains asking me to enter the parameter value. Even when I do it doesn't filter the sub form on the page.

    Any hints?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    What is the Data Type of the field called "FulfilledBy" and what Data Type is returned by "Me.cbo_FulfilledBy"?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    What is specified in the parameter prompt? Is FulfilledBy a text field, or numeric. If text, you need delimiters around the value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    It’s text. So the combo lists the systems fulfilling the reqs and in the table it’s shorttext. Example would be SaaS + APIs

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Try

    myFulfilledBy = "Select * from CPReqs where [FulfilledBy] = '" & Me.cbo_FulfilledBy & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    so so so good - thank you. So I was using parenthesises when I should have gone for single quotes. Your fix prepares a proper str which is what I have declared. So the full sub routine is



    Private Sub cbo_FulfilledBy_AfterUpdate()
    Dim myFulfilledBy As String


    myFulfilledBy = "Select * from CPReqs where [FulfilledBy] = '" & Me.cbo_FulfilledBy & "'"
    Me.sfrm_CPReqs.Form.RecordSource = myFulfilledBy
    Me.sfrm_CPReqs.Form.Requery


    End Sub


    I think you have helped me out before mr PBaldy some time ago in fact. Great to see you are still here helping folk out. Well done. Have a great weekend.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Error was due to lack of apostrophe delimiters. The parentheses were irrelevant. Look at any SQL statement in query object and you will see Access has thrown in a bunch of unnecessary parentheses.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    so so so good - thank you. So I was using parenthesises when I should have gone for single quotes. Your fix prepared a proper str which is what I have declared. So the full module is



    Private Sub cbo_FulfilledBy_AfterUpdate()
    Dim myFulfilledBy As String


    myFulfilledBy = "Select * from CPReqs where [FulfilledBy] = '" & Me.cbo_FulfilledBy & "'"
    Me.sfrm_CPReqs.Form.RecordSource = myFulfilledBy
    Me.sfrm_CPReqs.Form.Requery


    End Sub


    I think you have helped me out before mr PBaldy some time ago in fact. Great to see you are still here helping folk out. Well done. Have a great weekend.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Quote Originally Posted by Raddle View Post
    I think you have helped me out before mr PBaldy some time ago in fact. Great to see you are still here helping folk out. Well done. Have a great weekend.
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Requery Combo Box from second form
    By blueman in forum Forms
    Replies: 14
    Last Post: 11-16-2015, 12:03 PM
  2. Combo Box Will Not Requery
    By clchapin in forum Programming
    Replies: 3
    Last Post: 08-01-2013, 08:51 AM
  3. Replies: 2
    Last Post: 06-03-2013, 11:52 AM
  4. Requery does not update combo box
    By pbouk in forum Forms
    Replies: 1
    Last Post: 03-25-2013, 03:01 PM
  5. Replies: 1
    Last Post: 03-13-2011, 02:29 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