Results 1 to 3 of 3
  1. #1
    CRobledo is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    26

    Blank combo box return all values?

    Hello, I need some help. I made a form with a combo box that filters a sub form based on the value selected in the conbobox. But I also would like to be able to see them all if I leave it blank.


    below is the code I used. can anyone tell me what i need to add or change to be able to see them all?




    Private Sub cboScholarshipType_AfterUpdate()
    Dim myApplicant As String
    myApplicant = "Select * from tbl_Applicants where ([Scholarships] = " & Me.cboScholarshipType & ")"
    Me.tbl_Applicants_subform.Form.RecordSource = myApplicant
    Me.tbl_Applicants_subform.Form.Requery
    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    myApplicant = "Select * from tbl_Applicants where [Scholarships] = " & Me.cboScholarshipType & " or " & Me.cboScholarshipType & " is Null"

    or you can use

    myApplicant = "Select * from tbl_Applicants
    if not isnull(Me.cboScholarshipType) then myapplicant=myapplicant & " where [Scholarships] = " & Me.cboScholarshipType

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why set RecordSource?

    Could set the form Filter and FilterOn properties.

    Is the subform linked to mainform data - Master/Child Link properties set?

    Review http://allenbrowne.com/ser-62.html
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2016, 05:50 AM
  2. Combo Box Values to Go Blank on Lost Focus
    By McArthurGDM in forum Forms
    Replies: 6
    Last Post: 02-20-2015, 01:22 PM
  3. Blank Values in Combo Box Selection
    By CementCarver in forum Access
    Replies: 1
    Last Post: 02-28-2013, 01:11 PM
  4. Combo Box showing Blank Values
    By glen in forum Access
    Replies: 5
    Last Post: 11-24-2012, 09:44 AM
  5. Replies: 9
    Last Post: 07-31-2012, 11:30 AM

Tags for this Thread

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