Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable is not found error
Message
 
To
18/06/2003 19:33:28
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00800976
Message ID:
00801548
Views:
17
Well, under normal circumstances I wouldn't consider that an improvement, however in this case it may add value. The problem is that it can't get the memory variable populated if it can't get to the table, however I'll give it a try 'cause it certainly won't make matters worse.


>There is less chance that the scan will have trouble with a simple memory variable, especially if a network problem is making the cursor vanish or something. Just because code has worked doesn't mean there is no better way to write it.
>
>>As I was trying to point out, the form that calls this code resides in a private data session, but the code that executes and that is throwing the error resides in the default data session. From there it runs and builds an array that is passed back to the calling method. So it's not like I'm trying to refer to the cursor that resides in the default data session from the private data session. The issue of changing data sessions is moot and not what is causing the problem. Your code change suggestion is appreciated, but any speed increase is not perceivable since this table is going to be quite small. Thanks, though.
>>
>>
>>>Hi Russell
>>>
>>>I'd make a little change to the code.
>>>
>>>
LOCAL lcUserOrGroup
>>>lcUserOrGroup = ModuleUsers.user_or_group
>>>scan for group_name = m.lcUserOrGroup
>>>
>>>I believe it would be faster for VFP to access a memory variable than a field name. I believe it would be safer to avoid potential effects of changing the record pointer in ModuleUsers. I'd expect changing data sessions to result in an Alias not found error with your code.
>>>
>>>>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
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform