Change query in access for mail merge

banks

Well-known member
Joined
Sep 7, 2005
Messages
50
Programming Experience
Beginner
Hi i have set up a mail merge document, and set the datasource to a query in my access 97 database. This works fine. The problem is that i need to change a parameter in the query, based on what record the user is currently looking at. So i need to change the carNo = 1 part of my SQL :-

VB.NET:
SELECT carNo, dateRaised, dateCARsent, e.fullName, b.supplierName, c.materialCode, suppOrderNo, ProductionDate, DeliveryDate, originIsCustomer, complaintNo, a.defectDesc, fsqOrderNo, holdNo, deliveryQty, f.defectDesc, machineTimeLost, scrapIncurred, supplierResponse, suppResponse, briefDesc, defectLocation, defectComments, setupOK, setupComments, sampleYN, sampleComments, testMethod, results, graphAtc, spreadAtc, chkAgainstSpec, specNo, specComments, conclusion
FROM tblCAR AS a, tblSupplier AS b, tblMaterial AS c, tblMaterialSupplier AS d, tblUser AS e, tblDefect AS f, tblDefectLocation AS g
WHERE a.MaterialSupplierId=d.materialSupplierId
AND b.supplierId = d.supplierId
AND c.materialID = d.materialID
AND a.UserId = e.userId
AND a.defectId = f.defectId
AND a.defectLocId = g.defectLocId
AND CARNO = 1;

Can i change this is access? Or on the the other side of things is it better to build the query in vb.net and pass that through to the document - but that poses me the problem of how i set the query created in vb to be the datasource of the document.

Any ideas, suggestions most welcome,

Cheers,
Alex
 
Back
Top