Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2002 NEXTIF won't properly advance pointer.
I have an MS Access program that exports an rtf file telling
volunteers when to appear for their assignments in a season, such as spring 2008. A volunteer can have one or more slots. A letter is sent to the volunteer telling her when to appear. Each appearance is on one line of the letter. Thus the letter might look like: ------------------------------------ Sally Smith (address) Dear Sally, You are scheduled for Monday 3pm Tuesday 4pm Tuesday 5pm Regards, Betty, Volunteer coordinator --------------------------------- The rtf file looks like: (2nd field is total for that person) John Davis 1 Wednesday 2pm Sally Smith 3 Monday 3pm Sally Smith 3 Tuesday 4pm Sally Smith 3 Tuesday 5pm Sandy Byard 1 Wednesday 3pm Everything is fine in Word2000. But it doesn't work right with Word 2002. The problem is the "NEXTIF" (Next Record If) statement at the start of the assignment line. It tests to see how many items are left for Sally, and stays on that page if there are any, else it drops to the bottom and goes to the next person. What happens in W2002 is: John Davis is correctly printed with one entry on his letter. Sally is correctly printed with three entries on her letter. But then, instead of going on to Sandy, Word seems to back up two records and prints a letter for Sally starting with her 2nd entry, namely Tuesday at 4pm. She gets two entries. Then it does it again for Sally, printing a letter with just her 3rd entry. Fijnally, it does go on to Sandy. It seems that the NEXTIF statement is bumping some internal pointer to get Sally's records, but there is another pointer that gets bumped only when a letter is finished, and this is bumped only one place. Because this works fine in Word 2000, I am suspecting a bug in Word 2002. I searched thru Google and Microsoft Web Page and found no referenct to this. Has anyone seen this? -- Pete Brady |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2002 NEXTIF won't properly advance pointer.
Can you post the relevant bits of field code here?
FWIW, a. I try to avoid NEXTIF/SKIPIF, i.e. I know about them through experiment more than practice b. it wouldn't surprise me if Word 2000 and Word 2002 NEXTIF did not behave the same way, as the specification of what they do is...well, not completely clear. -- Peter Jamieson http://tips.pjmsn.me.uk "Pete Brady" wrote in message ... I have an MS Access program that exports an rtf file telling volunteers when to appear for their assignments in a season, such as spring 2008. A volunteer can have one or more slots. A letter is sent to the volunteer telling her when to appear. Each appearance is on one line of the letter. Thus the letter might look like: ------------------------------------ Sally Smith (address) Dear Sally, You are scheduled for Monday 3pm Tuesday 4pm Tuesday 5pm Regards, Betty, Volunteer coordinator --------------------------------- The rtf file looks like: (2nd field is total for that person) John Davis 1 Wednesday 2pm Sally Smith 3 Monday 3pm Sally Smith 3 Tuesday 4pm Sally Smith 3 Tuesday 5pm Sandy Byard 1 Wednesday 3pm Everything is fine in Word2000. But it doesn't work right with Word 2002. The problem is the "NEXTIF" (Next Record If) statement at the start of the assignment line. It tests to see how many items are left for Sally, and stays on that page if there are any, else it drops to the bottom and goes to the next person. What happens in W2002 is: John Davis is correctly printed with one entry on his letter. Sally is correctly printed with three entries on her letter. But then, instead of going on to Sandy, Word seems to back up two records and prints a letter for Sally starting with her 2nd entry, namely Tuesday at 4pm. She gets two entries. Then it does it again for Sally, printing a letter with just her 3rd entry. Fijnally, it does go on to Sandy. It seems that the NEXTIF statement is bumping some internal pointer to get Sally's records, but there is another pointer that gets bumped only when a letter is finished, and this is bumped only one place. Because this works fine in Word 2000, I am suspecting a bug in Word 2002. I searched thru Google and Microsoft Web Page and found no referenct to this. Has anyone seen this? -- Pete Brady |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2002 NEXTIF won't properly advance pointer.
"Peter Jamieson" wrote: Can you post the field codes here? Peter, Here is a portion of the rtf file. I have omitted the fields in each record beyond the first seven. ------------------- VolSrch VolID DayOfWeek TimeOfDay CountOfVolID VolName addison 1427 2 5:30 PM 1 Brianne Addison 732-918- arcomano 1388 5 4:45 PM 1 Noelle Arcomano 732-671 Beccarelli 324 2 3:00 PM 2 Bob Beccarelli 732-957- Beccarelli 324 2 4:00 PM 2 Bob Beccarelli 732-957- bickerton 1171 3 4:30PM 1 BethBickerton 732-536- ------------------------------------ Here is part of the letter that reads the above file ------------------------------------ Type date here {MERGEFIELD FirstLine} {MERGEFIELD SecondLine} {MERGEFIELD ThirdLine} {MERGEFIELD FourthLine} Subject: Your assignments for volunteering in the upcoming quarter of the year. Dear {MERGEFIELD FirstLine}, Based on the availability you provided, we have assigned you to volunteer with {IF {MERGEFIELD CountOfVolID = 1 "one course" "{MERGEFIELD CountOfVolID } courses"}, as follows: Dayof Week Time of Day Student Name Instructor (The next line makes no IF tests because it is the first record, which we know is present} {MERGEFIELD WeekDay} (tab) {MERGEFIELD TimeOfDay} (tab) MERGEFIELD Student_Name} (tab) {MERGEFIELD Instructor} ¶ (Here follow ten more lines which are nearly identical. Only the count test differs, as explained below.) {NEXTIF {MERGEFIELD CountOfVolID 1 } {IF MERGEFIELD CountOfVolID} 1 "(tab) {MERGEFIELD weekday} etc} ¶"} {NEXTIF {MERGEFIELD CountOfVolID 2 } {IF MERGEFIELD CountOfVolID} 2 "(tab) {MERGEFIELD weekday} etc} ¶"} This continues thru count test = 11, at which point the tests stop and the bottom of the letter is printed. After we get past the actual count, eg "2"), all subsequent IF tests fail and the pointer remains at the last record and no line gets printed. ------------------------------- In the above example, the first two people get proper letters with one session listed. But Beccarelli gets two letters. The first lists the two courses correctly, as it should, and we can mail the letter to him. The second letter lists only his second course. If he had five courses, he would get five letters, the first listing all 5, the next listing 4 starting at course #2, etc. Finally, the program gets off of Beccarelli, and Bickerton gets the correct letter. As I mentioned, this works fine in Word 2000. If it would help, I could email you the actual files for you to try and merge. As it loooks now, I probably will install Word 2000 on her machine, without removing W2003, so she can run this program as she did before. Thanks for your reply. Pete Brady |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
nextif function examples | Mailmerge | |||
NEXTIF | Mailmerge | |||
NextIf | Mailmerge | |||
nextIf | Mailmerge | |||
2002 word doc does not display properly in word 2003 | Microsoft Word Help |