Hi all,
I'm trying to use VBA to open a form with link criteria to column(5) in a form control but I get invalid function. (referring to "lngzEntrantID.Column" in the link criteria)
Basically, I need to make sure that it doesn't equal either value in 2 variables I have filled up.
My code is as follows:
Any ideas?
I initially tried to do it in SQL but couldn't get it to work, so thought I could try it with VBA link criteria when opening the form instead.
Thanks in Advance,
Simon
I'm trying to use VBA to open a form with link criteria to column(5) in a form control but I get invalid function. (referring to "lngzEntrantID.Column" in the link criteria)
Basically, I need to make sure that it doesn't equal either value in 2 variables I have filled up.
My code is as follows:
Code:
strBanksianSelect = "SELECT TOP 1 qryShowEntrantClassPoints2.lngzShowID, " _
& "qryShowEntrantClassPoints2.lngzEntrantID, " _
& "qryShowEntrantClassPoints2.SumOfNumPoints " _
& "FROM qryShowEntrantClassPoints2 " _
& "ORDER BY SumOfNumPoints DESC;"
'Instead of a where clause in the SQL Statement.
strBanksianLinkCriteria = "lngzEntrantID.column(5) <> '" & strBanksianWinner1 & "' AND '" & strBanksianWinner2 & "'"
'replace existing query with the above one
CurrentDb.QueryDefs("qryShowEntrantClassPoints").SQL = strBanksianSelect
'print sql statement
MsgBox strBanksianSelect
DoCmd.OpenForm "frmShowEntrantClassPoints", , , strBanksianLinkCriteria, , acDialog
Me.lngzEntrantID = Form_frmShowEntrantClassPoints.lngzEntrantID
Any ideas?
I initially tried to do it in SQL but couldn't get it to work, so thought I could try it with VBA link criteria when opening the form instead.
Thanks in Advance,
Simon