Showing posts with label word. Show all posts
Showing posts with label word. Show all posts

Monday, March 26, 2012

Easy query help... :(

Hi,

I'm trying to write a sql query to create a report that will act kind of like a Mail Merge in Microsoft Word. I want to send letters to our customers to remind them their machines need to be ballbar'd or calibrated.

My database is set up as follows:

CustomerInformation(CustomerID[pk], CompanyName, CompanyPhone, etc etc etc)

CustomerMachine(MachineID[pk], MachineManufacturer, MachineModel, MachineSerialNumber, MachineSize, CustomerID[fk])

LaserCalibrations(LaserID[pk], LaserDate, MachineID[fk])

Ballbars(BallbarID[pk], BallbarDate, MachineID[fk])

My query looks like this:

SELECT CustomerInformation.CustomerID, CustomerMachine.CustomerID, CustomerMachine.MachineID, CustomerMachine.MachineManufacturer, CustomerMachine.MachineModel, CustomerMachine.MachineSerialNumber, CustomerMachine.MachineSize, LaserCalibrations.LaserID, LaserCalibrations.LaserDate, LaserCalibrations.MachineID

FROM CustomerInformation, CustomerMachine, LaserCalibrations

WHERE (((CustomerInformation.CustomerID)=CustomerMachine .CustomerID) And ((CustomerMachine.MachineID)=LaserCalibrations.Mac hineID))
ORDER BY CustomerInformation.CompanyName, LaserCalibrations.LaserDate;

The problem is that it will not print the laser calibration dates in order. I wanted to include a history of past service on the letter. I tried to write the query including ballbars, but it got too messy, I think I was missing a "Distinct" descripter. I also want to change the price according to the size of the machine... and I'm not certain how to go about doing that.

Please help :)

Thanks!you have here two unrelated one-to-many relationships that cannot easily be combined in one query

if a single machine has 3 LaserCalibrations and 4 Ballbars, the query will return 12 rows for that machine

you need two separate queries, one for LaserCalibrations and a separate one for Ballbars

Wednesday, March 7, 2012

Dynamic Width of textbox

Hi,
how can i set the width of a textbox dynamically ?
Ex: The text box has to expand in width to fit the availble data. It
shouldnt word wrap.
ex: hello how are you NOT hello how
are youSince you can not use an expression for textbox width, I do not think you
can do this...You would probably end up with bigger problems anyway, because
textboxes overlapping would be a problem unless you moved the others that
were affected by the size change anyway...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Ramani" <Ramani@.discussions.microsoft.com> wrote in message
news:E1CF20D3-CD14-4DB6-A380-3B5C694C26CB@.microsoft.com...
> Hi,
> how can i set the width of a textbox dynamically ?
> Ex: The text box has to expand in width to fit the availble data. It
> shouldnt word wrap.
> ex: hello how are you NOT hello how
> are you