Using Access 2003 (2000 format)
A church database. On a form there is a list box that includes the names of 20 Retirement Homes in which members might live.
The secretary can click on any one in the list and print a report, for the Ministers, of those people from the church who live in that specific Retirement Homes.
What she would like to be able to do is click one command button and print a report for all Retirement Homes at once. At the moment, this can't happen.
Here is the SQL code for the list box.
One of the difficulties is that there are a few Homes in the list in which none of the church members live.
The code behind the current button to Preview All is
The report "rptAddressSelect(AllAddresses) is based on a query with the following SQL
This SQL does not work. It results in an "expression too complicated to evaluate" error. When it runs from the form the error number is 3107
[Text2] refers to a text box on the form in which the secretary can enter the first few letters of the Street upon which the Retirement Home is located.
[Text19] refers to a text box on the form in which the secretary can enter the street # on the street upon which the Retirement Home is located.
Any suggestions would be appreciated.
Tom
A church database. On a form there is a list box that includes the names of 20 Retirement Homes in which members might live.
The secretary can click on any one in the list and print a report, for the Ministers, of those people from the church who live in that specific Retirement Homes.
What she would like to be able to do is click one command button and print a report for all Retirement Homes at once. At the moment, this can't happen.
Here is the SQL code for the list box.
Code:
SELECT tblRetirementHome.RetHomeID, tblRetirementHome.RetirementHome, [StreetNbr] & " " & [Street] & ", " & [City] AS Address, tblRetirementHome.StreetNbr, tblRetirementHome.Street, tblRetirementHome.City
FROM tblRetirementHome
ORDER BY tblRetirementHome.RetirementHome;
One of the difficulties is that there are a few Homes in the list in which none of the church members live.
The code behind the current button to Preview All is
Code:
Dim stDocName As String
stDocName = "rptAddressSelect(AllAddresses)"
DoCmd.OpenReport stDocName, acPreview
The report "rptAddressSelect(AllAddresses) is based on a query with the following SQL
Code:
SELECT qryDirectory.FullNames, qryDirectory.HouseNbr, qryDirectory.Street, qryDirectory.HomePhone, Left([tblTrinity]![Street],4) AS SA1, Val(Trim(Right([tblTrinity]![HouseNbr],Len([tblTrinity]![HouseNbr])-InStr([tblTrinity]![HouseNbr],"-")))) AS SA2, Val(Trim(Left([tblTrinity]![HouseNbr],Len([tblTrinity]![HouseNbr])-InStr([tblTrinity]![HouseNbr]," -")))) AS SA3, [SA2] & " " & [SA1] AS SA4
FROM qryDirectory
WHERE (((qryDirectory.Street) Like [Forms]![frmAddressSelect]![Text2] & "*" And (qryDirectory.Street) Not Like "New Ad*") AND ((Val(Trim(Right([tblTrinity]![HouseNbr],Len([tblTrinity]![HouseNbr])-InStr([tblTrinity]![HouseNbr],"-"))))) Like [Forms]![frmAddressSelect]![Text19] & "*")) OR (((qryDirectory.Street) Is Null))
ORDER BY Left([tblTrinity]![Street],4), Val(Trim(Right([tblTrinity]![HouseNbr],Len([tblTrinity]![HouseNbr])-InStr([tblTrinity]![HouseNbr],"-")))), Val(Trim(Left([tblTrinity]![HouseNbr],Len([tblTrinity]![HouseNbr])-InStr([tblTrinity]![HouseNbr]," -"))));
This SQL does not work. It results in an "expression too complicated to evaluate" error. When it runs from the form the error number is 3107
[Text2] refers to a text box on the form in which the secretary can enter the first few letters of the Street upon which the Retirement Home is located.
[Text19] refers to a text box on the form in which the secretary can enter the street # on the street upon which the Retirement Home is located.
Any suggestions would be appreciated.
Tom