Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2013

    Unanswered: Join Query Not working

    I have two tables “tblAssets” and “tblMaintContracts”, which I need to query to get only the assets with maintenance contracts. I am getting Runtime error ‘3075’: Syntax error in query expression.
    This is my code:

    Dim strSQL As String

    'Display only assets (equipment) with maintenance contracts
    strSQL = "SELECT tblAssets.* " & _
    "INNER JOIN tblMaintContracts.* " & _
    "ON tblAssets.AssetId = tblMaintContracts.AssetId;"

    ‘populate form with recordset
    Form_frmAssetsContracts.RecordSource = strSQL

    Do you see anything askew?
    Thanks for your help.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you haven't specified a 'FROM table' name
    select * from tblAssets

    your join syntax looks odd

    inner join tblMaintContracts
    ON tblAssets.AssetId = tblMaintContracts.AssetId;
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2013
    Thanks for taking a look at my question. This is how I got it to work. Yes, I had missed the FROM:

    strSQL = "SELECT tblAssets.*, tblMaintContracts.* " & _
    "FROM tblAssets INNER JOIN tblMaintContracts " & _
    "ON tblAssets.AssetId = tblMaintContracts.AssetId; "

    Thanks again.

Posting Permissions

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