Some times it's necessary to code all the details of your grid, e.g.
With thisform.Grid
.RecordSource = ""
.RecordSource = "previous_alias"
with .Column1
.ControlSource = "previous_alias.Field1"
.Width = 40
.Header.Caption = "Field 1"
...
endwith
with .Column2
...
endwith
EndWith
If you've got your grid set up nicely at design time then just copy across the values stored in these prop's to you above routine.
HTH
Terry
>Thankyou for your answer. It works, but I have to redifine the number of columns and the headertexts and which field to be shown, because when I refresh as you wrote, the whole table i shown with all columns.
>
>>Hello
>>
>>
>>Thisform.Grid.RecordSource = ""
>>*** requery the data here
>>Thisform.Grid.RecordSource = "previous_alias"
>>Thisform.Refresh
>>
>>
>>>Hallo!
>>>I wonder if anyone can help me with a problem I have.
>>>
>>>I do a SQL-select, and open a form with a grid that shows the SQL result.
>>>It works as it should... BUT
>>>If I make a new SQL-select while the form is open, I loose the headers, columns and everything in a grid. The only thing left is a white square.
>>>I can not make a refresh or anything. But if I close the form and then open it again, the result is showing in the grid.
>>>
>>>In a list or combo I can use requery to update with new data, but how do I do in a grid?
>>>
>>>Thanks
>>>/Kjell
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.