Results 1 to 2 of 2
  1. #1

    SubForms view (A2K SR1)

    I have a form with inmate information in a jail. The form lists the demographics for the inmates and has numerous sub-forms.

    I need a sub form that lists the medications which are current and a separate form which lists the medications which are expired. So we can look and see what someone is on now and what they have been on in the past.

    The field which toggles this is a logical (Yes/No) field called DC. The record resides in a table called MEDS and is linked to the main demographics table called Inmates. (Original I know).

    When I try to set the two sub forms to show the medications the one which shows the current meds works fine. I copied the sub form and pasted it with a different name and went in to the on open event and this is the code I put in it.

    Private Sub Form_Open(Cancel As Integer)
    Me.Filter "DC 0"
    Me.FilterOn True
    End Sub

    When I went to the other sub form, called subfrmMeds Expired this is the code in it

    Private Sub Form_Open(Cancel As Integer)
    Me.Filter "DC 1"
    Me.FilterOn True
    End Sub

    The subfrmMeds works, the subfrmMedsExpired doesn't.

    I am not sure what I am doing wrong.

    ANY help would be appreciated as I am really confused here.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: SubForms view (A2K SR1)


    Frankly, I don't understand why either should work, since the syntax of your code is incorrect. Filter and FilterOn are properties that should be set with =, like this:

    Private Sub Form_Open(Cancel As Integer)
    End Sub


    Private Sub Form_Open(Cancel As Integer)
    End Sub

    Don't know if that will work, though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts