RunTime Error 438

D

DS

I'm getting the Error 438 when I try to fill a Listbox with this
code...it works fine when I run the Query but not when I run it from a form.

With Forms!frmCheckPayment!ListPayment
..Rowsouce = "SELECT tblSecurityDetails.SDPayTypeID, tblPayName.PayName,
" & _
"tblJobNames.JobNameID, tblJobNames.JobNameSecurityID, " & _
"tblPayName.PayNameExpDate, tblPayName.PayNameID " & _
"FROM (tblJobNames INNER JOIN tblSecurityDetails ON
tblJobNames.JobNameSecurityID = tblSecurityDetails.SecurityID) " & _
"INNER JOIN tblPayName ON tblSecurityDetails.SDPayTypeID =
tblPayName.PayNameTypeID " & _
"WHERE (((tblJobNames.JobNameID) = [Forms]![frmCheckAction]![TxtJobID])
" & _
"And ((tblJobNames.JobNameSecurityID) =
[Forms]![frmCheckAction]![TxtSecure]) " & _
"And ((tblPayName.PayNameExpDate) <= Date))Or (((tblJobNames.JobNameID)
= [Forms]![frmCheckAction]![TxtJobID]) " & _
"And ((tblJobNames.JobNameSecurityID) =
[Forms]![frmCheckAction]![TxtSecure])) " & _
"ORDER BY tblPayName.PayName;"
..ColumnCount = 6
..ColumnWidths = "0 in;2 in;0 in;0 in;0 in;0 in"
..Requery
End With

Thanks
DS
 
D

DS

DS said:
It doesn't show the specfic Line when I debug.
Thanks
DS
Sorry it's the last Line Order By...
If I remove that line, and make the previous line the last one then it
fails there!!!
Thanks
DS
 
D

DS

DS said:
Sorry it's the last Line Order By...
If I remove that line, and make the previous line the last one then it
fails there!!!
Thanks
DS
It was the Line <=Date()))
I added the Extra ) and that worked!
Thnaks
DS

With Forms!frmCheckPayment!ListPayment
.RowSource = "SELECT tblSecurityDetails.SDPayTypeID,
tblPayName.PayName, " & _
"tblJobNames.JobNameID, tblJobNames.JobNameSecurityID, " & _
"tblPayName.PayNameExpDate, tblPayName.PayNameID " & _
"FROM (tblJobNames INNER JOIN tblSecurityDetails ON
tblJobNames.JobNameSecurityID=tblSecurityDetails.SecurityID) " & _
"INNER JOIN tblPayName ON
tblSecurityDetails.SDPayTypeID=tblPayName.PayNameTypeID " & _
"WHERE (((tblJobNames.JobNameID) = Forms!frmCheckAction!TxtJobID) " & _
"And ((tblJobNames.JobNameSecurityID) =
Forms!frmCheckAction!TxtSecure) " & _
"And ((tblPayName.PayNameExpDate) <= Date())) " & _
"Or (((tblJobNames.JobNameID) = Forms!frmCheckAction!TxtJobID) " & _
"And ((tblJobNames.JobNameSecurityID) =
Forms!frmCheckAction!TxtSecure)) " & _
"ORDER BY tblPayName.PayName;"
.ColumnCount = 6
.ColumnWidths = "0 in;2 in;0 in;0 in;0 in;0 in"
.Requery
End With
 
Top