Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: JohnnyLong
  • Order by date
  1. JohnnyLong

    SELECT using an ID from a SELECT

    Thanks for the input everyone. Thanks Ryan, here is my query. DECLARE @pKeyID int SET @pKeyID = 12347 SELECT * FROM rc_Events WHERE MeetingID = (SELECT TOP 1 MeetingID FROM rc_Events WHERE EventID = @pKeyID) UNION SELECT * FROM rc_Events WHERE EventID = (SELECT TOP 1 MeetingID FROM rc_Events...
  2. JohnnyLong

    SELECT using an ID from a SELECT

    We use SQL Server 7. This is how my rc_Events data looks: EventID MeetingID 12345 0 12346 12345 12347 12345 12348 12345 12349 0 12350 54321 12351 54321 I want to select the MeetingID records with the ID 12345 and the EventID with the ID 12345 using @pKeyID which...
  3. JohnnyLong

    SELECT using an ID from a SELECT

    Yes, you're right! been a long day. Should read SELECT rc_Contacts.ContactID, rc_Events.EventID, rc_Events.MeetingID FROM rc_Contacts LEFT OUTER JOIN rc_Events ON rc_Contacts.ContactID = rc_Events.ContactID WHERE rc_Events.MeetingID=@pKeyID UNION SELECT rc_Contacts.ContactID...
  4. JohnnyLong

    SELECT using an ID from a SELECT

    Sorry, that wasn't very clear was it? The first Select picks everything where the rc_Events.MeetingID = the passed parameter @pKeyID I also need to Select all records where rc_Events.MeetingID = the rc_Events.MeetingID selected from the first select. I did a UNION query because that seemed...
  5. JohnnyLong

    SELECT using an ID from a SELECT

    Hi, My second Select is based on the results of the first Select. SELECT rc_Contacts.ContactID, rc_Events.EventID, rc_Events.MeetingID FROM rc_Contacts LEFT OUTER JOIN rc_Events ON rc_Contacts.ContactID = rc_Events.ContactID WHERE rc_Events.MeetingID=@pKeyID UNION SELECT...
  6. JohnnyLong

    Select Max into one row

    Thank you so much Alex and George you are life savers, I would never have worked this out myself. I have tweaked the code to include counts and a few more joins, but it appears to be doing exactly want I want. SELECT co.BranchCode, co.Representative, cl.ClientName, co.DecisionMaker...
  7. JohnnyLong

    Select Max into one row

    I need to show the subject for both calls, the most recent completed & the most recent uncompleted. Here are my fields: SELECT co.BranchCode, co.Representative, rc_Clients.ClientName, co.DecisionMaker, co.ContactSurname, co.ContactFirstname, co.SalesType, co.SalesStatus, rc_Clients.Terms...
  8. JohnnyLong

    Select Max into one row

    Thanks Alex, that works. Any idea why my Max(Date) isn't working though. I'm getting all the calls for each contact whereas I only want the latest completed call and the latest uncompleted call. Thanks
  9. JohnnyLong

    Select Max into one row

    Hi, I have 2 tables, rc_Contacts and rc_Calls. Each contact can have many calls. rc_Calls has a CompletedFlag column of 1 or 0. I need to select the last completed call and the last uncompleted call and display the results in one row. Surname Subject MaxCallDate1 Subject MaxCallDate2...
  10. JohnnyLong

    Insert text into first page header only.

    The first column is pre-filled and the second column is entered by the user. The user opens the cv, clicks the format button, types the candidates details in the second column, checks the formatting of the cv text and saves the document.
  11. JohnnyLong

    Insert text into first page header only.

    Ok, the header is just our company logo .jpg and the header is text, address, phone numbers etc. The table on the first page is a summary table, 10 rows by 2 columns: Applicant Joe Bloggs Contact 020 8777333 Nationality British Resides London Willing to...
  12. JohnnyLong

    Insert text into first page header only.

    Hi Gerry, We receive cv's in .doc or .rtf format. They always have different layouts; different margins, fonts, number of pages etc. I want to open the cv in Word, click the button on the toolbar and trigger the macro to do what you said above: 1. go to the start of the CV document 2. add a...
  13. JohnnyLong

    Insert text into first page header only.

    Gerry, one more thing:-) Is there an easy way to copy the margin settings of the CV across? NewDoc uses the templates margins and this can alter the formatting of the CV. Not a big deal but a happy user is a quiet user!! John
  14. JohnnyLong

    Insert text into first page header only.

    Thanks alot Gerry, you're a star. I couldn't get Selection to be a property of ActiveDocument but this code works: Set NewDoc = ActiveDocument With NewDoc .ActiveWindow.Selection.EndKey Unit:=wdStory .ActiveWindow.Selection.InsertBreak Type:=wdPageBreak...
  15. JohnnyLong

    Insert text into first page header only.

    Hi Gerry, I am trying to format CV's with a standard template. The template contains a header and a footer and a table in the main body. I want the user to open the CV and click the Format CV button on the toolbar in Word. This will insert the template header on the first page and footer on all...
  16. JohnnyLong

    Insert text into first page header only.

    Hi again. Following on from the above I have recently had to change the template .dot. As before it has a header and footer and now there is a table in the main body. Why is it that when the code is run, the table doesn't appear in the new document? Instead it seems to be pasted over. Any ideas...
  17. JohnnyLong

    Contractors churn rate

    Don't worry guys, problem solved.
  18. JohnnyLong

    Contractors churn rate

    Hi, I have been asked to produce a query showing the churn rate for our contractors. We have a timesheet table which records their weekly timesheets, the week number and date of each timesheet. I need to show the length in weeks of each contractors assignment with any break between timesheets of...
  19. JohnnyLong

    Insert text into first page header only.

    Brilliant :-) All works great. Thanks alot Gerry, you are a star. I had to change .Range.PasteAndFormat to .Range.PasteSpecial as I presume you have a later version of word. Thanks again for your time, you are a credit to Tek-tips. Regards, John
  20. JohnnyLong

    Insert text into first page header only.

    Thanks again Gerry, I'm getting there slowly! I have the TestCVConversion code behind a macro button. I have set up the .dot template with the headers and footers and in the Page Setup - Layout - checked the different first page box. However, I am still getting the header on each page. I need...

Part and Inventory Search

Back
Top