Hi Bryan,
> BUT the use appears to open the table but a browse shows no records even though numrecords gives the correct numbers.
>
As a guess, if RecCount('yourAlias') > 0 and Browse appears to be empty, that sounds as if either the browsed alias contains deleted rows only while Set('Deleted')='On', or as if it is not the expected one.
The latter can happen if your code is running while a Grid control with a different .RecordSource is being the ActiveControl of the current _screen.ActiveForm
As for your code:
> PARAMETERS mydbffile
Local declarations and "LParameters" instead of "Parameters" are important to avoid assigning or unintentionally accessing variables with the same name being created in previous call-stack levels.
> mytable=Juststem(mydbffile)
Assumed the "mydbffile" parameter always contains a valid full-path table file name, you may not want to use JustStem() here.
> Select 0
>
> Use (mytable) In 0 Alias 'TEMP_1'
>
> Select TEMP_1
>
If you "Select 0", you already have "next unused" workarea, so you do not need another "... In 0" with the USE command and can get rid of the following "Select temp1".
In addtion, your code does not care whether alias name "temp_1" may already be in use currently. And you can use the "Again" clause anyway to get independent of the table itself already being open with a different Alias name
So your function could basically do something like:
Use (m.mydbffile) Shared Again In (Select('temp_1')) Alias temp_1
&& (Select('temp_1')) returns zero if the alias is not used, or the work-area number if it is
hth
-Stefan
> In my application I create a large table from a number of other related tables and save it to a folder in My Documents.
>
> The table name is SQL copied from TEMP_1 as COMTAGLIST preceeded by a prefix being the projectname of the subject project with the other tables.
>
> I want to offer the ability to add to some of the table fields with another run through a prg table scan/endscan where more options have been chosen. This needs the selected table name to be TEMP_1
>
> My problem is that I need to select a particular COMTAGLIST table where the user may have a number for different projects.
> As I know the full file name I can test for it and then open it and do a scan again adding to some of the fields.
>
> BUT the use appears to open the table but a browse shows no records even though numrecords gives the correct numbers.
>
> - here is the routine code .
>
>
>
> PARAMETERS mydbffile
>
> logging('Creating new List')
>
> mytable=Juststem(mydbffile)
>
> Select 0
>
> Use (mytable) In 0 Alias 'TEMP_1'
>
> Select TEMP_1
>
> numrecords = Reccount() - shows 7384 records in this case
>
>
> logging('Open table '+mytable+ ' as ' +Alias() + ' Records to be scanned -: '+ Transform(numrecords ))
>
> (this shows as '6:13:45 PM Open table MY NEW PROJECT_1_COMTAGLIST as TEMP_1 Records to be scanned -: 7854')
>
> && carry on on existing table - bryan
>
>
>
> Using the View command TEMP_1 is shown as the current table but the browse window shows empty fields in a single record.
>
> Can anyone help me out with this?
>
> -Bryan