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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Union Query Format 6
Two Column Report 3
Field >0 2
SQL Rowsource 1
DSum Problem 2
ListBox Rowsource 2
SQL Woes 4
Can a DCount be done within SELECT DISTINCT? 0

Top