Could someone tell me what is wrong with this procedure? It will print only one record and then stops with this message: " Dialog program error — dialog will be aborted."
local sorternumber
local numbergroups
getscrap “Enter # of groups”
numbergroups = val(clipboard())
getscrap “Enter Group # to start With”
sorternumber = val(clipboard()) -1
OpenSheet
SelectAll
LOOP
sorternumber = sorternumber +1
Field “DCGroup#”
Select «DCGroup#» = sorternumber
Field “First name”
SortUp
Field “Last name”
SortUp
OpenForm “Camper Snack List”
print dialog
UNTIL sorternumber = numbergroups
Okay, I incorporated the printtopdf statement, and I no longer get the error message. The loop seems to work just fine as I am able to follow along with the message statements and see that it is moving from one set of info to the next. However, even though it goes through the loop properly, only the last page created by the loop is printed.
I could really use some help, as we are having to pull one group list or snack list at a time and print individually 56 group lists a day. I’m sure there is a way to print these off in a timely manner. This is what I have currently in the procedure:
local sorternumber
local numbergroups
local counter
getscrap “Enter # of groups”
numbergroups = val(clipboard())
getscrap “Enter Group # to start With”
sorternumber = val(clipboard()) -1
counter = 0
OpenSheet
SelectAll
You’re using the same filename for the PDF each time, therefore for each iteration of the loop you overwrite the one you’ve just generated, leaving only the last one remaining at the end.
Change "GroupLists.pdf" to "GroupLists"+counter+".pdf" — or something like that — to create a separate PDF each time.
Dave and PCNewbie, you are geniuses! We used both approaches. PCNewbie’s worked wonders when we need the group list in a .pdf format to email to the counselors each week. Dave’s worked super to print off the snack accounting sheets to give to the snack staff to record the purchases on as the campers come to the snack shop. You both saved us a tremendous amount of time.
It looks like you are relying on first name SorUp to hold after the second Last Name Sortup. But if at some point, because of data or whatever, it didn’t, or someone else had to work with that procedure, it might be a problem difficult to track down.
I could be wrong, but wouldn’t be more direct and explicit to say:
Field “Last Name”
Sortup
Field “First Name”
SortupWithin
It seems if you get some duplicate field content, your two SortUp’s might not give you want you want.
Sorting FirstName within LastName just seems the most direct and clearest way to ensure the result you want. IMHO
It’s actually ok to do it the way @Dipper79 did it. Panorama’s sort algorithm is what’s called a “stable” sort so when a second sort is performed, if there are duplicate values, the order of the first sort is maintained. So sorting by first name then last name gives exactly the same result as sorting by last name and then sorting within by first name. Either is fine.