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

    Filter Value from a form placed in a text box

    I have a form called (Orders Switchboard_frm) that has a combo box (Group_cmb) with values in them. When I select a value in the "Group_cmb" combo box, a form (Requisitions_frm) opens and displays data based on the value I clicked on the combo box on the "Orders Switchboard_frm" form.
    I have a button on the "requisitions_frm" called "add record" which basically adds a record to the table.
    I would like to, when the "add record" button is pressed, to have the value from the "requisitions_frm" filter be placed in a field called "group" on the same form. So I came up with this easy code:



    Me.Group.Value = Me.Filter

    This all works very well except I get:

    [Group] = 'TheTextIWant' in the "Group" field

    I would like to get rid of

    [Group] = ' ' and only have "TheTextIWant" part. Keep in mind that "TextIWant" is a variable

    Anyone know how to do this?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Me.Group = Mid(Me.Filter, 2, Len(Me.Filter) - 2)

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try Replace(Me.Filter,"'","")

    This assumes no other apostrophes will be encountered. If there could be and you don't want them eliminated, then RuralGuy's suggestion is the safe method.
    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.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Another good suggestion June7.

  5. #5
    Musicguy2112 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    8
    Thanks alot guys! this actually worked!

    Me.Group = Mid(Me.Filter, 12, Len(Me.Filter) - 12)

    Much appreciated, I've been on this for awhile!

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for posting back with your success and solution.

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

Similar Threads

  1. Text Box Filter Question
    By ShadeRF in forum Forms
    Replies: 4
    Last Post: 06-07-2011, 07:58 AM
  2. Filter List box using text box
    By oakoen in forum Forms
    Replies: 3
    Last Post: 12-13-2010, 05:00 PM
  3. form filter using form text box value
    By NDBCaccess in forum Access
    Replies: 1
    Last Post: 10-28-2010, 09:23 PM
  4. Filter by combo box & text box?
    By sparkyboy2406 in forum Forms
    Replies: 2
    Last Post: 02-24-2010, 04:20 PM
  5. Filter non-text data
    By bdriscoll in forum Access
    Replies: 2
    Last Post: 09-25-2009, 05:49 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