Results 1 to 4 of 4
  1. #1
    jdpharm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    2

    Selecting patient name from combo box to filter subform datasheet on navigation tab

    Hello All,



    I'm working on a database tracking patients upon hospital discharge. I have a main navigation form with multiple navigation tabs. Each of the navigation sheets has a embedded subform in datasheet view.

    The database contains:

    patient table including name, date of birth, pt_id (primary key)

    discharge table including discharge date, notes, pt_id, discharge_id(primary key)

    interventions table including discharge_id, intervention type, intervention_id (primary key)

    On the navigation form in the footer I have a combo box (searchcbo) that pulls from the patient table listing (in separate columns) name, date of birth (and pt_id hidden) I would like to use this combo box to filter what is shown on the first navigation page of the navigation form. This first page is titled discharges and with no filter would show query results pulled from the patient and discharge table in a subform titled discharge_qrysubform.

    The query contains name, date of birth, date of discharge, notes on discharge. It is shown in datasheet view. When a name is selected in the combo box, i would like the after update function to filter the results based on patient id only to show those discharged for the given patient.

    I've tried using the following vba code:

    Private Sub searchcbo_AfterUpdate()
    discharge_qrysubform.Form.Filter = "[pt_id]= '" & searchcbo & "'"
    discharge_qrysubform.Form.FilterOn = True
    End Sub

    and all i get is a object required 424 error. Any help or suggestions would be greatly appreciated.

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,948
    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
    jdpharm is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    2
    Thanks June7,

    I've entered

    Private Sub searchcbo_AfterUpdate()
    [Forms]! [Dashboard_main]![discharge_qrysubform]!Filter = "[pt_id]= '" & searchcbo & "'"
    [Forms]![Dashboard_main]![discharge_qrysubform]!FilterOn = True
    End Sub

    and am getting an error 2465 can't find field 'discharge_qrysubform'

    I double checked and this is the correct name of the subform.

    Any other hints?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,948
    Are you using a Navigation form/control? The referenced link did not help?
    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. Filter Subform by Combo Box Dates
    By steve042 in forum Forms
    Replies: 14
    Last Post: 06-20-2013, 07:36 AM
  2. Replies: 3
    Last Post: 03-29-2013, 02:36 PM
  3. Replies: 19
    Last Post: 07-23-2012, 10:34 AM
  4. Selecting a Record in Datasheet view
    By JFo in forum Access
    Replies: 3
    Last Post: 11-01-2011, 10:10 PM
  5. Replies: 2
    Last Post: 08-18-2011, 10:20 PM

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