Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2010
    Posts
    23

    Form Filtering

    Hey everyone. I am trying to find a way to filter a VB form but am currently stuck. Right now I have two different forms, one for browsing records and one for editing them. What I would like to do is to place a command button on the product browsing page that when clicked will open just the selected record in the product edit page.



    The information in the product edit page is pulled from a table called "Basic Info".

    The information on the product browsing page is pulled from a query called "Main Query" which pulls the information from the Basic Info table and does some filtering and other manipulations.

    Each product is assigned an ID number when its record is generated, so I would like to have the product edit form open and show only the record highlighted in the list box on the Product Browsing page. I was thinking maybe there might be a way to filter by the products ID number?

    Any ideas would be greatly appreciated.

    Thanks,
    Sam

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    If I understand your post; the opening arguments of the Open Form method will work. Take a look at that syntax and you will see you can specify a record to open to.

    Hope this helps.

  3. #3
    Join Date
    Aug 2010
    Posts
    23
    I tried to use the OpenForm code to filter the records but it doesn't seem to work. Here is what I have so far.

    Dim LogNumber As String
    IdNumber = Combo46.Column(0) (Main table on the product search page)
    DoCmd.OpenForm "Product Edit", acNormal, "Main Query", , , , "ID Number" = IdNumber
    DoCmd.Close acForm, "Product Search"

    So when the command button is clicked its supposed to look at column 0 of the combo box to grab the ID number of the highlighted record.

    Then the Product Edit form is open, and the "ID Number" is set equal to the string IdNumber which is supposed to filter the records. This however doesnt seem to work.

  4. #4
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Should your filter name and where condition statements be separated by just one comma?

  5. #5
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    recheck that syntax

    off the cuff I see: "ID Number" = IdNumber

    shouldn't that be:

    "ID Number =" IdNumber

  6. #6
    Join Date
    Aug 2010
    Posts
    23
    Sorry for the late reply. I fixed the syntax and everything seemed to check out but I was unable to get the filter to work. I played around with it a little and managed to get it to work using the code listed below:

    DoCmd.OpenForm "Product Edit", acViewNormal, , "ID Number = " & IdNumber
    Anyways, thanks for the help, I appreciate it.

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

Similar Threads

  1. Filtering a continuous form
    By sbrookebounds in forum Forms
    Replies: 10
    Last Post: 08-14-2012, 09:56 AM
  2. Query (Filtering?) in a Form
    By bobhra in forum Forms
    Replies: 2
    Last Post: 01-09-2011, 02:45 PM
  3. Filtering a Continuous Form
    By sbrookebounds in forum Forms
    Replies: 5
    Last Post: 12-14-2010, 11:41 AM
  4. remove filtering of a form
    By maxbre in forum Forms
    Replies: 3
    Last Post: 10-30-2010, 10:22 AM
  5. Question on filtering a form
    By jbarrum in forum Forms
    Replies: 12
    Last Post: 02-15-2010, 11:38 AM

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