Results 1 to 5 of 5
  1. #1
    dog is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    3

    Fix for VBC err Caompile Error: Label Not Defined

    VBC:

    Private Function BuildFilter() As Variant
    Dim varWhere As Variant
    Dim tmp As String
    tmp = """"

    Const conJetDate = "\#dd\/mm\/yyyy\#"

    varWhere = Null

    If Me.aMemName > "" Then
    varWhere = varWhere & "[Mem_FN] like " & tmp & Me.aMemName & tmp & " AND "
    End If

    BuildFilter = varWhere
    End Function


    Private Sub cmdSearch_Click()
    On erorr GoTo errr
    Me.Members_Table_subform.Form.RecordSource = " SELECT * FROM Members_Table " & BuildFilter
    Me.Members_Table_subform.Requery


    End Sub


    errr:
    MsgBox Err.Description
    Exit Sub

    I need a fix for this.

  2. #2
    dog is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    3
    I found a fix but got a run-time error this time.

    Run-time error '3131':
    Syntax error in FROM clause

    Private Sub SearchV_Click()
    On erorr GoTo errr
    Me.Members_subform.Form.RecordSource = "SELECT * FROM [Members] " & BuildFilter
    Me.Members_subform.Requery
    errr:
    MsgBox Err.Description
    Exit Sub
    End Sub

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You might use this technique to see the finished SQL:

    http://www.baldyweb.com/ImmediateWindow.htm

    You are missing the keyword WHERE and leaving the " AND " at the end.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    JoeyB is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Location
    The Netherlands / Australia
    Posts
    54
    Edit: nevermind

  5. #5
    dog is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    3

    Unhappy

    Quote Originally Posted by pbaldy View Post
    You might use this technique to see the finished SQL:

    http://www.baldyweb.com/ImmediateWindow.htm

    You are missing the keyword WHERE and leaving the " AND " at the end.
    I'm new to Visual Basics and it's fair to say that I don't know much about the language.
    I don't know how to fix it even after studying the link very well.
    So I'd like to post the fixed CODE. Please.
    Last edited by dog; 01-16-2014 at 10:26 PM.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-12-2013, 04:13 PM
  2. Replies: 1
    Last Post: 03-14-2013, 12:39 PM
  3. Replies: 1
    Last Post: 12-14-2012, 12:32 AM
  4. Replies: 4
    Last Post: 06-08-2012, 09:08 AM
  5. Application-defined or object-defined error
    By hawkins in forum Access
    Replies: 6
    Last Post: 07-01-2011, 01:57 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