Computer is about to get smashed!!!

Sam Summers

Registered User.
Local time
Today, 23:00
Joined
Sep 17, 2001
Messages
939
I have a report that is base on a query. I am attempting to print from a button on a form using the code:

stDocName = "ConformancyCertRpt"
DoCmd.OpenReport stDocName, acNormal

This report uses the following query:

SELECT Equipment.EquipmentID, Equipment.LocationID, Equipment.EquipRef, Equipment.ItemNo, Equipment.TestDate, Equipment.CertID, Equipment.Scrapped, Equipment.Lost, ConformancyCerts.CertNo, EquipLookup.EquipDescription, EquipLookup.ENNumber
FROM ConformancyCerts INNER JOIN (EquipLookup INNER JOIN Equipment ON EquipLookup.EquipRef = Equipment.EquipRef) ON ConformancyCerts.CertID = Equipment.CertID
WHERE (((Equipment.Scrapped)=False) AND ((Equipment.Lost)=False) AND ((ConformancyCerts.CertNo)=[Forms]![ViewbyConformancy]![CertNo].[Text]))
ORDER BY EquipLookup.EquipDescription;

Prior to all this, the original form is opened via a parameter form (FindConfAccess), using the code:

CertNumber.SetFocus
stDocName = "ViewbyConformancy"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.Close acForm, "FindConfAccess"

Even though I can open the query and see the data and also preview the report, when I print the report it prints only the headings but no data?

I am on the virge of battering my computer to death!!!!!!!!!!

Many thanks if you can save the computer from going to the scrapyard!!!!
 
is the query a stored query or a sql string that you build in code

if its in code then you would need to refer to the form control a little differently,if the certno is a number

WHERE (((Equipment.Scrapped)=False) AND ((Equipment.Lost)=False) AND ((ConformancyCerts.CertNo)=" & [Forms]![ViewbyConformancy]![CertNo].[Text]))

if its a text data
WHERE (((Equipment.Scrapped)=False) AND ((Equipment.Lost)=False) AND ((ConformancyCerts.CertNo)=" & """" & [Forms]![ViewbyConformancy]![CertNo].[Text] & """" ))
 
Have you tried leaving "FindConfAccess" open while printing the report? It's almost certain that having closed it your parameters have disappeared
 
Thanks guys

I had a think and ended up using Rich's idea which worked.

So thanks very much
 
Thanks very much for the warning Pat.
I see what you mean.
There's always so many little things to watch out for or learn. I'll get there one day hopefully?
 

Users who are viewing this thread

Back
Top Bottom