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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unknow member

Status
Not open for further replies.

Qwark

Programmer
Sep 26, 2000
59
NL
Hello,

I have a form(frmForm) with a page frame(pgfPages) and a couple of pages(pagOne, pagTwo). On pagOne I have add a grid control (grdPerson) with a couple of columns

In my frmForm.init function I have programmed the next text:
this.pgfPages.pagOne.grdPerson.RecourdSource = "cursoraliasname"
this.pgfPages.pagOne.grdPerson.grcColumnone.ControlSource = "cursoraliasname.street"

And it works, but

I have made a search button on the pagOne page. In the click method of that button i have type:

<first i update the cursor that is working>

thisform.pgfPages.pagOne.grdPerson.RecourdSource = &quot;cursoraliasname&quot; && is working
thisform.pgfPages.pagOne.grdPerson.grcColumnone.ControlSource = &quot;cursoraliasname.street&quot; && is not working.

I get the error &quot;Unknow Member grcColumnone&quot;.
Making this instead of thisform doesn't work. Making an object by addobject is working, but not correctly. I get to much columns by the last trying point.

Can you help me

Thanks,

Qwark

 
Hi Qwark,

Just a question in your update routine, upon updating, do u do repopulate the cursor with dat again?

YJ
 
Qwark, when you change grids record source, grid oftenly just rebuilds self using defaild columns and controls, losing everything defined originally on the form in design time. So, when you access grcColumnone in grid it might not exist just because grid was rebuilt.
This is bad thing, but good thing is that there is solution available for this problem. Just before changing record source, or refreshing grid by assigning record source again, or requery view that is record source of grid, or close cursor for grid and than open (query) it again, use following:
MyGrid.RecordSource = &quot;&quot; && clear it temporarily
.... && do any changes related to record source
MyGrid.RecordSource = &quot;MyRecordSource&quot;

Note that this requires also assigning of each control source for each column again after such refreshing, unless your grid column and column order exactly match cursor's fields order.



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
I agree it's a very bad thing, but thaaaaaank you very much it works perfectly!!

Qwark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top