I have a many-to-many relationship between two tables necessitating a third table. All are connected via unique ID's and foreign keys. All is working fine except that on one of my forms I have a grid that displays firstname, lastname and some telephone numers in different columns. I need to have the grid ordered by lastname. Since the ID's in the RecordSource are not in lastname order I can see no way to order the grid. I have tried using the 'click on header' method mentioned in a previous thread but it did not work. My first question is should it be able to work? If so, how?
I then tried creating a cursor for the grid and all worked fine as far as putting the data in the columns but the TRANSFORM to include hyphens in the telephone numbers caused the headers in the grid to change to the field names from the target table and EXP_3, EXP_4, EXP_5 for the three telephone number columns. I have tried putting thisform.grid1.column3.caption = "Home Phone" etc. in the INITEVENT of the form but it did nothing. The code I am using is:
In the form's LoadEvent...
CREATE CURSOR scl (firstname c(15), lastname c(15), ;
hphone c(12), wphone c(12), ;
cphone c(12), address m, ;
paid c(1), paidby c(6), datechrgd d)
In the DestroyEvent...
SELECT scl
use
In the COMBO1 InteractiveChangeEvent used to choose the event for listing the attendees in the grid...
PUBLIC eve as Integer
eve = events.eventid
SELECT attendees.firstname, attendees.lastname, ;
TRANSFORM(attendees.hphone, '999-999-9999'), ;
TRANSFORM(attendees.wphone, '999-999-9999'), ;
TRANSFORM(attendees.cphone, '999-999-9999'), ;
attendees.address ;
FROM attendees ;
left JOIN atteve ON atteve.attendeeid = attendees.attendeeid ;
and atteve.eventid = eve ;
where atteve.attendeeid is .not. null ;
ORDER BY 2 ;
INTO CURSOR scl
thisform.grid11.refresh
thisform.grid11.recordsource=thisform.grid11.recordsource
How and where can should I reset the captions for the headings to what they should be?
I read Mike's comment in an earlier thread that if properly coded the cursor should not have to be recreated. In my case I don't see how it is possible.
Any help appreciated,
Rich
I then tried creating a cursor for the grid and all worked fine as far as putting the data in the columns but the TRANSFORM to include hyphens in the telephone numbers caused the headers in the grid to change to the field names from the target table and EXP_3, EXP_4, EXP_5 for the three telephone number columns. I have tried putting thisform.grid1.column3.caption = "Home Phone" etc. in the INITEVENT of the form but it did nothing. The code I am using is:
In the form's LoadEvent...
CREATE CURSOR scl (firstname c(15), lastname c(15), ;
hphone c(12), wphone c(12), ;
cphone c(12), address m, ;
paid c(1), paidby c(6), datechrgd d)
In the DestroyEvent...
SELECT scl
use
In the COMBO1 InteractiveChangeEvent used to choose the event for listing the attendees in the grid...
PUBLIC eve as Integer
eve = events.eventid
SELECT attendees.firstname, attendees.lastname, ;
TRANSFORM(attendees.hphone, '999-999-9999'), ;
TRANSFORM(attendees.wphone, '999-999-9999'), ;
TRANSFORM(attendees.cphone, '999-999-9999'), ;
attendees.address ;
FROM attendees ;
left JOIN atteve ON atteve.attendeeid = attendees.attendeeid ;
and atteve.eventid = eve ;
where atteve.attendeeid is .not. null ;
ORDER BY 2 ;
INTO CURSOR scl
thisform.grid11.refresh
thisform.grid11.recordsource=thisform.grid11.recordsource
How and where can should I reset the captions for the headings to what they should be?
I read Mike's comment in an earlier thread that if properly coded the cursor should not have to be recreated. In my case I don't see how it is possible.
Any help appreciated,
Rich