Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2013
    Posts
    2

    Unanswered: Help with Run-time Error 3075

    Hi all,
    I am a complete novice when it comes to code but I have managed to stumble through until I hit this error.


    'Syntax error (missing operator) in query expression
    '[TBL_Client].[ContactName]=Stefan Teat'

    My code is
    Code:
    Private Sub SearchResults_DblClick(Cancel As Integer)
        
        Dim stDocName As String
        Dim stLinkCriteria As String
    
        stDocName = "FRM_Site_Popup"
        
        stLinkCriteria = "[TBL_Client].[ContactName]=" & Me![SearchResults]
        DoCmd.OpenForm stDocName, , , stLinkCriteria
    I am using Access 2010 and what I am doing is using a search form to show a list of
    records coming from a search text box that the user enters data into, to reduce the search.
    From this, the user can then double click a record and up pops a new form window with all
    of the data associated with that record.

    Here is a link to my database if you want to view it (it's 49mb in size though)
    https://dl.dropboxusercontent.com/u/...p.v9.100.accdb

    Please help.... and many thanks in advance
    Last edited by fekka; 08-20-13 at 09:14. Reason: update

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    text literals/values MUST be delimited so that the SQl engine knows where they start and stop
    so try:-
    Code:
     stLinkCriteria = "[TBL_Client].[ContactName]='" & Me![SearchResults] & "'"
    or
    Code:
     stLinkCriteria = "[TBL_Client].[ContactName]=" & chr(39) &  Me![SearchResults] & chr(39)
    just for information if you use dates then they should be in the ISO format yyyy-mm-dd and delimited with hash marks eg:
    mydatecolumn = #2013-08-20#
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Aug 2013
    Posts
    2
    Thanks for your help healdem .... Much appreciated

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •