Results 1 to 4 of 4
  1. #1
    Musicguy2112 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    8

    Using a filter on a different form

    Hello! Still a bit new to access and VB but getting better! I have a form called "Orders Switchboard_frm" which has a combo box called "PurchasingApproval_cmb". When a value in the combo box is selected, a password form appears (frmPassword) to limit access to the next form that will be opened (RequisitionApproval_frm). I have this code on the OnClick event of a button on the password form, but I would like the "myVar" to get the filter off of a selection from the combo box on the "Orders Switchboard_frm" form. Anyone know how to do this? Thanks in advance.

    Private Sub cmdOK_Click()
    Dim myVar



    myVar = "[Group] = '" & PurchasingApproval_cmb.Value & "'"

    If Me.txtPassword = "Password" Then

    DoCmd.OpenForm "RequisitionApproval_frm", WhereCondition:=myVar
    DoCmd.Close acForm, Me.Name
    Else
    MsgBox "Incorect Password", vbCritical, "Input Data Error"
    Me.txtPassword.SetFocus
    Me.txtPassword = ""
    End If
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Sure, just use the full form reference:

    Forms Refer to Form and Subform properties and controls
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Musicguy2112 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    8
    I keep getting "service unavailable" but I will try later

    thanks

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    If it continues,

    Forms!Orders Switchboard_frm.ComboName
    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. Replies: 2
    Last Post: 11-25-2013, 10:56 AM
  2. Replies: 2
    Last Post: 08-18-2011, 10:20 PM
  3. LogIn Form to filter Main Form
    By ggs in forum Forms
    Replies: 5
    Last Post: 07-12-2011, 04:27 AM
  4. how to set up filter in form
    By Brigitt in forum Forms
    Replies: 1
    Last Post: 10-28-2010, 07:39 AM
  5. Form Filter
    By smikkelsen in forum Forms
    Replies: 5
    Last Post: 07-13-2010, 08:21 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