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

Opening a table for a grid

Status
Not open for further replies.

mpgalvin

Programmer
Feb 5, 2001
119
IE
I'm having some trouble with WHEN to open a table that is being used by a grid. I've set the grid up in design time, so that it's recordsource is "currency", and all the columns are currency.field1, .field2, etc

Now, I want to only have the currency table open while this form is open (so ideally, it would be opened and closed at the same time as the form).

I tried putting the USE... statement into the form.init event, but apparently, the recordsource of the grid is read before the init event, so I get "Alias currency is not found". Is there any way I can do this, without setting the grid at runtime, or opening the currency table before the form is loaded?
 
Open your table in the load event of the form.

Set the datasession property of the form to "private datasesion", when the form is closed, the table is closed with the form.

HTH,

Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
weedz, that doesn't appear to have made any difference. If it helps any, the form is being called by an external menu file (I'm calling the menu with do &appPath.delmenu.mpr), and it's at the point where I click the menu option that it crashes ("READ EVENTS" is the actual line).

I don't know what difference that makes.
 
Could you post the command that is issued from the menu bar that causes the crash ??

Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
weedz:
Code:
DO &appPath.delmenu.mpr && appPath is a variable pointing to the current application directory

.
.
.

READ EVENTS

The menu appears (in delmenu.mpr, I have the line of code &quot;DO FORM CURRENCY&quot; against the menu option I'm selecting) and when I click on one of the options, I get 'Grid1 <or one of its members>.ControlSource : Alias &quot;CURRENCY&quot; is not found.' The above program pops up (I turned off error handling) and the READ EVENTS line is highlighted.

I realise that probably doesn't help at all.
 
Oops, my mistake. It appears that the menu code was looking for the 'currency' form in the main directory, whereas the one I was changing is in subdirectory off that. So, all the changes I was making weren't actually being used.

Sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top