Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.Dataenvironment.AddObject & Buffering
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00063231
Message ID:
00063288
Vues:
44
>>Also, do you have to USE the table as well as adding it to the environment?
>>WITH Thisform
>> .Dataenvironment.Addobject([Cli_name],[Cursor])
>> .Dataenvironment.Cli_name.Buffermodeoverride =2
>>ENDWITH
>>SET STEP ON
>
>Dumb question: why are you adding it programmatically?
>
>Since I'm sure you have a good answer for this, you're right that just adding the table
>doesn't work. One possibility would be to fire the .DE.Closetables, add the cursor, and
>file .DE.OpenTables. Another possibility would be to turn .AutoOpenTables off, and just
>fire .OpenTables after you add the cursor. Doing it in Activate, though, is wrong, as
>Sylvain said.

I'm creating a utility program to allow the users to determine which fields are mandatory in all of their entry screens. It will also allow them to add their own fields to the file, and delete fields (not the core fields--only the ones they've added). Each file, like the Clients file, has an associated name file, like Cli_name. There are over a hundred files, and if programmatically adding to the dataenvironment doesn't work (though I'm sure it works--I don't yet know how), I'll have to limit where the users have this power and create a form for each file that I allow them to modify. Or I could throw caution to the wind and not do table buffering, but this product is going into several mental health facilities, where data integrity is extremely necessary, and I don't want to take that chance. The Name files, like Cli_name, consist of a structure similar to what you'd get if you did a copy structure extended, but there are more fields (Field_name, Field_len, etc., but also Field_core and Field_mand).

The following is currently in the init of the form. I want it to use some table when the user first comes in, and to test I'm using Cli_name. In other parts of the form, where the user changes the file, this code will be changed to make a memory variable out of everywhere there is cli_name in the following code. If I can make this code work, I know I'll be able to make that code work.

When I run this:

IF LEN(RTRIM(Thisform.Namefile)) =0
WITH Thisform
WITH .Dataenvironment
.Closetables
.Addobject([Cli_name],[Cursor])
.Cli_name.Buffermodeoverride =2
.Opentables
ENDWITH
.Field_name.ControlSource =[Cli_name.Field_name]
.ChkField_core.ControlSource=[Cli_name.Field_core]
.ChkField_mand.ControlSource=[Cli_name.Field_mand]
.SpnField_len.ControlSource =[Cli_name.Field_len]
.SpnField_dec.ControlSource =[Cli_name.Field_dec]
.NameFile =[Cli_name]
.MainFile =[Clients]
.CboFilename.Value =[Clients]
.Objsrefresh
ENDWITH
ENDIF

with autoopentables on, it gives me an error at .opentables, of course. So I turn autoopentables off, and it runs to the .ChkField_core.ControlSource=[Cli_name.Field_core] line, where it errors and tells me that Cli_name isn't found.

If I tell it to USE the file, it doesn't do buffering.

Thanks for your help, and pls let me know if you can think of anything else!

JR
CLARC Services, Inc.
3500 Tamiami Trail
Port Charlotte, FL 33952
www.clarc.com
(941) 743-0108
(800) 246-5488
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform