Results 1 to 5 of 5
  1. #1
    jzeig1 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2018
    Posts
    6

    Can't apply filter on form from comboBox - run-time error 3075

    Not sure if this is the rite section / page to post this but here goes.
    I am trying to figure out what is the best method of (1) either change the underlining RecordSource of the forms data or (2) should I use the filter property to goto record
    The form consist of a main for with member: firstName, lastName, middleName. I also have a combobox with mbr_ID and Name: [mbr_LastName] & ", " & [mbr_FirstName].
    I've tried a couple of ways to do it, but keep getting errors. The current method is something like this:

    Dim StrMemNam as String
    strMemNam = "SELECT tblMembers.*, tblMembers.[mbr_ID] FROM tblMembers WHERE (((tblMembers.[mbr_ID])='" & Nz(Me.cmbMemNam.Column(0)) & "'));" Me.Filter = strMemNam
    Me.FilterOn = True
    Syntex error in query expression 'Select tblMembers.*,tblMembers[mbr_ID] FROM tblMembers WHERE (((tblMembers.[mbr_ID])='123'));'.

    Humm, the more I learn the harder this gets

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    The Filter expression only needs to be the "WHERE" part of the "SELECT" statement without the "WHERE", so yours should be something like:

    (tblMembers.[mbr_ID])='" & Nz(Me.cmbMemNam.Column(0)) & "'

    However, if "
    mbr_ID" is a number field rather that a text field then the quote marks used as delimiters are not needed, so perhaps you need something like:

    "tblMembers.[mbr_ID]= Nz(Me.cmbMemNam.Column(0))"
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    jzeig1 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2018
    Posts
    6
    OK, so here's where we stand.
    Private Sub cmbMemNam_AfterUpdate()
    Dim strMemNam As String
    strMemNam = "tblMembers.[mbr_ID] = Nz(Me.cmbMemNam.Column(0))"
    Me.Filter = strMemNam
    Me.FilterOn = True
    End Sub

    The "Me.Filter = strMemNam" evaluates to MeFilter = strMemNam = True; which doesn't make much sence to me.
    And Me.Filter = True

    The error comes back as Run-time error '3085' Undefined function 'Me.cmbMemNam.Column' in expression.

    btw: thanks

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    This line isn't right

    Code:
    strMemNam = "tblMembers.[mbr_ID] = Nz(Me.cmbMemNam.Column(0))"
    Something like

    Code:
    strMemNam = "tblMembers.[mbr_ID] = " & Nz(Me.cmbMemNam.Column(0))

  5. #5
    jzeig1 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2018
    Posts
    6
    @andy49 Thanks. That did the trick. ;-)

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

Similar Threads

  1. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  2. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 2
    Last Post: 02-25-2013, 10:47 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

Tags for this Thread

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