David R
I know a few things...
- Local time
- Today, 02:20
- Joined
- Oct 23, 2001
- Messages
- 2,633
I've done this dozens of times, I don't know why this database is flipping out on me. (Apologies for the convoluted code, it started out giving the "too few parameters" error when runSQL referenced the form that was running the code, so I had to break the loop.
Having gotten around that problem, now when it gets to ConcatRelated it is giving a VERY strange error.
Ideas?
Code:
Dim addrs As String
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim proj As String
Dim bpkg As String
Dim contrs As String
Dim olApp As Outlook.Application
Dim objMailContr As Outlook.MailItem
Set olApp = Outlook.Application
contrs = ConcatRelated("ContractorEmail", "queryEmailContractors", , , ";")
proj = [Forms]![formLetters]![textProjNum]
bpkg = Val([Forms]![formLetters]![textBidPkg])
'see how many addresses we'll be using
Set rs = CurrentDb.OpenRecordset("SELECT ProjectNumber, BidPackage, CaseAddress, CaseID " & _
"FROM tableCases WHERE ((ProjectNumber = " & Chr(34) & proj & Chr(34) & ") AND (BidPackage = " & bpkg & ") AND (CaseStatus < 50 AND CaseStatus <> 25))")
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst 'Unnecessary in this case, but still a good habit
If rs.RecordCount = 1 Then
addrs = "<li>" & rs!CaseAddress & "<i>(" & ConcatRelated("StructureType", "queryExhibitAs", "CaseID = '" & rs!CaseID & "'", "ExhibitID", " AND ") & ")</i></li>"
Else
While Not rs.EOF
addrs = addrs & "<li>" & rs!CaseAddress & "<i>(" & ConcatRelated("StructureType", "queryExhibitAs", "CaseID = '" & rs!CaseID & "'", "ExhibitID", " AND ") & ")</i></li>"
rs.MoveNext
Wend
End If
Else
MsgBox "No addresses are coming up eligible for bid in this project, sorry."
Set rs = Nothing
Exit Sub
End If
If I run ConcatRelated in the Immediate window, it works just fine.Access said:Error 2465 DB Support Database can't find the field '!1' referred to in your expression.
Ideas?