Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable is not found error
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00800976
Message ID:
00800977
Views:
24
Is the cursor created in Load() event of the form? The most common oversight I have seen is that cursors are created in the Init() of the form and if any containing control's Init() has cursor references, it gives error because Control.Init() fires before Form.Init().

Do you switch datasessions?

>Unfortunately, this is not your standard "Variable is not found" error. Here's what's going on:
>
>I have a combo box that will list the users who have security rights to a given form. This is so that when a user adds a record, but the user adding the record is not the logged in user, he or she can select their own name from the list of authorized form users to indicate who actually added the record (instead of it defaulting to the logged in user). This has been in place for a good while and has been working just fine. But recently they've been getting intermittent errors. The line that throws the error is:
>
>scan for group_name = ModuleUsers.user_or_group
>
>and the error is:
>
>Variable 'USER_OR_GROUP' is not found.
>
>ModuleUsers is a cursor created with this code (which, of course, runs before the code above):
>
>select distinct rights.user_or_group;
> from rights;
> where alltrim(rights.r_module) == MyModule;
> into cursor ModuleUsers
>
>There is no conditional code around that SQL Select statement, so it executes every time (the combobox calls the UsersWithRightsToModule procedure, which has all the above code in it). Of course, if the SQL statement returns no records, the cursor is still created. So referring to it as I do in the SCAN statement should not cause an error.
>
>At present, I attribute this to some sort of network or hardware error. Over the past two days, they have been having very bad network problems causing people to not be able to log in and even locking up their workstations. Additionally, in the past, I've seen an error that was similar. I have an internal messaging feature built into my apps. It uses a table called MESSAGES. Every 60 seconds the table is checked for incoming messages for the logged in user. This code has been in and working from day one. But back in February it started throwing an error 13 (Alias 'MESSAGES' is not found). MESSAGES is opened at system start up and never closed. Additionally, if the table is not open for some reason, the ChkForMsgs procedure will open it. So to get that error was quite bizarre. I attributed it to some sort of network disconnect. VFP knew the file was open, but then couldn't actually access it.
>
>At present, I can see no problem in the code and this is code that has always worked fine and that I haven't changed in quite a while. So I attribute it to hardware and/or network issues. I've seen hardware issues at another client cause the most bizarre errors, but only on one machine. Replacing the machine solved the errors. So I certainly know that it can happen. However, I'm always willing to take another look at my code. Does anyone see any issues or know of anything that might cause errors such as these?
>
>Thanks,
>
>Russell Campbell
- Jayesh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform