Results 1 to 7 of 7
  1. #1
    Varda is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    44

    Question Search Form with Combo Box - Filtered

    I'm still trying to adjust from MS Access 2003 to MS Access 2007, and can't quite get why I have this problem and how to resolve it. Hopefully, someone can help me out. I'm sure it's simple.



    I have a form and a combo box that is supposed to find a record on the form. For some reason, when I open the Form it seems to be blank (which is fantastic, as that's what I would like it to be), but....when I select a name from the combo box nothing appears on the form (the fields are all blank instead of filled with the information relevant to the record selected).

    When I click on Toggle Filter, everything seems to be back into working function.

    So here are my questions:
    1. How do I open a form where it's always blank when opened up?
    2. How do I ensure that once a record is selected in the combo box, the form displays all fields of information properly?


    I'm uploading here my database. It's the form called "People - Data Entry." The combo box is all the way at the top of the form.

    I would appreciate any insight.

    Thank you in advance,
    Varda

    ComboBox_RefTables.zip
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    frmAllPeopleInfo has DataEntry property set to Yes. This means the form cannot display existing records.

    I don't use macros, only VBA.

    1. Set the form DataEntry to No. Then use code in the form Open event to move to new record.
    DoCmd.GoToRecord , , acNewRec

    2. Code in the combobox AfterUpdate event to either filter the form or move to desired record.
    To filter:
    Me.FilterOn = False
    Me.Filter = "PersonID=" & Me.cboSearchPersonID
    Me.FilterOn = True
    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.

  3. #3
    Varda is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    44
    Quote Originally Posted by June7 View Post
    1. Set the form DataEntry to No. Then use code in the form Open event to move to new record.
    DoCmd.GoToRecord , , acNewRec

    I appreciate the explanation of what Data Entry means (it isn't very self explanatory. I just figured it means "should I allow a person to enter data into the form" and not that it means "this form should be used only for new data entry.").

    I tried your suggestion (in the quote above), but it's not working the way I expected. What happens now - I open the form and it has values entered in the lower fields (below the combo box).

    I thought I should expect to see a completely blank form if I told it to go to a new record. So what else am I doing wrong?

    Thank you for your help.

    Varda
    PS I much prefer VBA over macros. I don't know anything about macros.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    I implemented my suggested code and the form opens to a blank new record for me.

    Did you select [Event Procedure] in the form Open event, click the ellipses (...) to open the VBA editor, type code in procedure?
    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.

  5. #5
    Varda is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    44
    I'm wondering if maybe there's something globally set wrong in my MS Access 2007 application that does not allow your code to work right.

    I'm attaching the database here, with the corrections you had directed me to make. On my computer, when I click the button to open the form "People - Data Entry" it shows values already in the fields, rather than show an empty form.

    I did set the database to enable macros, just in case this was the issue.

    And yes, I did place the code in the VBA editor.

    Thank you for your patience and help with this,

    Varda

    SearchCombo_Filtered.zip

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    You don't have the Open event code behind frmAllPeopleInfo:

    Private Sub Form_Open(Cancel As Integer)
    DoCmd.GoToRecord , , acNewRec
    End Sub
    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.

  7. #7
    Varda is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    44
    You should see me slapping my forehead and admitting stupidity. Thank you for being so patient with me and not pointing the obvious to me without using some obscene words ("you idiot" comes to mind as appropriate).

    I can't even explain why I did not notice this. I'm typically more on top of it.

    I'll try and pay better attention next time I post here. I really appreciate your help.

    Varda

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

Similar Threads

  1. Export Filtered Query to Excel Using Combo Box on Form
    By besuchanko in forum Import/Export Data
    Replies: 0
    Last Post: 02-07-2013, 10:10 PM
  2. Combobox Filtered Search
    By dgwynn in forum Access
    Replies: 3
    Last Post: 12-12-2012, 03:10 PM
  3. Replies: 7
    Last Post: 08-08-2012, 03:28 PM
  4. Replies: 1
    Last Post: 07-30-2011, 03:21 PM
  5. Replies: 5
    Last Post: 01-02-2011, 10:09 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