Results 1 to 8 of 8
  1. #1
    Ramun_Flame is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    19

    Filter out empty fields(Text boxes) after changing control source.

    So, I want to filter out a form based on the value in a text box. The text box is called details, and it changes control source based on buttons. When it changes control source, I want it to filter out the blank text boxes. If I filter by the control source, it takes forever to load, so I want to try filtering by the text box values.



    I tried this:

    DoCmd.ApplyFilter , "Not isnull([Details]) AND (Student_Name = 'Cancelled' OR isNull(Student_Name)) " & " AND CDate([Day] & ' ' & [StartT]) BETWEEN #" & Now() & "# AND Date() + 8 "


    The text box is called [Details], but it doesn't recognize it, and asks me for it's value.

    Is there any way to do this?

    Thank you.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if that's your statement you have a problem on the end of the line. You have:

    .... + 8"

    when it probably should be

    ... + 8 & "#"

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    One other thing to mention, instead of applying a filter you can probably build your form on a query and have the criteria of the query be the two variables you have shown.

  4. #4
    Ramun_Flame is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    19
    It's using two tables, so if I build it on a query, I can't enter values in the form. The date part works fine, it's just the text box.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    "Not Isnull([Details]) AND ([Student_Name] = 'Cancelled' OR isnull([Student_Name])) AND CDate([Day]) Between #" & date() & "# AND #" & date() + 8 & "#"

    (I don't use filters but this is my best guess and works when I apply it to a test form)

    With regard to you using two tables, if the items on the tables are related use a form/subform for your data entry.

  6. #6
    Ramun_Flame is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    19
    Like I said, the date part works fine. Details is not a field in my table, it's the name of a text box I'm using and changing to control source of.

    When I try this:

    DoCmd.ApplyFilter , "Not Isnull([Details])"

    It asks me for a value for Details.

    I think it's looking for details as if it is a field in the table. How do I make it look for a text box?

    Edit:

    Don't need to do this anymore. Thanks anyways for the suggestions.
    Last edited by Ramun_Flame; 10-28-2012 at 09:04 AM.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    is details an actual field on your form, check the NAME, not the CONTROL SOURCE.

  8. #8
    Ramun_Flame is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    19
    Details is the name of the text box, there is no field details in my table. I found out that you cannot filter based on the textbox name, only table fields, and I don't even need to do this anymore.

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

Similar Threads

  1. Replies: 8
    Last Post: 07-30-2012, 04:43 PM
  2. Text Box Control Source Issue
    By timbit6002 in forum Forms
    Replies: 8
    Last Post: 03-01-2012, 02:03 PM
  3. DLookup() for Text Box Control Source
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 02-06-2012, 02:21 PM
  4. IIF statement in control source of text box
    By LilMissAttack in forum Reports
    Replies: 11
    Last Post: 08-18-2011, 10:02 PM
  5. Control Source for Text Box (#error)
    By km8415 in forum Forms
    Replies: 3
    Last Post: 06-27-2010, 10:45 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