Hi everyone,
This one is stumping me really good. The query entered in my filter below will work as a stand alone query in Access but I keep getting a syntax error when I try to run it through a button. I thought it could have something to do with the single quotes around my text criteria but I tried double quotes as well. If anyone can help I'd be so grateful. I actually had it working once and then went and added the criteria about (Count_Stations .STATUS) = 'Active' and (Traffic.COUNT_ STATUS) = 'Updated' and then it wouldn't work. I tried removing these and still no luck. The syntax is copied right out of the SQL view in Access and it's working fine there.
Thanks Ramprat
This one is stumping me really good. The query entered in my filter below will work as a stand alone query in Access but I keep getting a syntax error when I try to run it through a button. I thought it could have something to do with the single quotes around my text criteria but I tried double quotes as well. If anyone can help I'd be so grateful. I actually had it working once and then went and added the criteria about (Count_Stations .STATUS) = 'Active' and (Traffic.COUNT_ STATUS) = 'Updated' and then it wouldn't work. I tried removing these and still no luck. The syntax is copied right out of the SQL view in Access and it's working fine there.
Thanks Ramprat
Code:
DoCmd.OpenForm "Count_Stations_Form", acNormal, "", "", , acNormal DoCmd.ApplyFilter "", "SELECT Count_Stations.PCID " & _ "FROM Counties INNER JOIN ((Count_Stations INNER JOIN AADT ON Count_Stations.PCID = AADT.PCID) " & _ "INNER JOIN Traffic ON Count_Stations.PCID = Traffic.PCID) ON Counties.CNTY_FIPS = Count_Stations.CNTY_FIPS " & _ "WHERE (((Count_Stations.STATUS) = 'Active') And ((Counties.DMA_NUM) = [Forms]![login_form]![DMA_textbox]) " & _ "And ((Abs(([Traffic]![COUNT] * [Traffic]![HOUR_FACTOR] * [Traffic]![DAY_FACTOR] * [Traffic]![MONTH_FACTOR] * [Traffic]![YEAR_FACTOR] - [AADT].[AADT]) / ([AADT].[AADT])) * 100) >= 20) And ((Traffic.COUNT_STATUS) = 'Updated'))"
Comment