Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning logical value to field
Message
From
10/05/1998 13:28:32
 
 
To
10/05/1998 08:12:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00098363
Message ID:
00098376
Views:
31
>I have a login form that allows a user 6 attempts to log into an application and a logical field in a users table called locked. After 6 attempts I would like to programmatically change this field to .T. but I can't figure out how to do it. Any ideas?

---------------- Reply ----

Bill,

A reasonable response from me would depend on how you are using the table you are trying to update. If it is a free table, you need to use conventional FoxPro code: open (or select) the table, update the field, close the table.

If the table is a part of the form's data environment, and the data environment is set to open the table when the form is instantiated, then you save the open table step, but you still have to select the table before trying to update it. If you issue a "replace myfield with .T." before selecting the table, you will get an error unless the table just happens to be the one selected at the moment.

When you select the table, it is also a good idea to preserve the table formerly selected so you can restore it.

Try something like
*-- Save the currently selected table, if any, so it may be
*   restored later
LOCAL lcOldSelect
lcOldSelect = ALIAS()

DO CASE
*-- See if the desired table is already selected
CASE lcOldSelect = myTable
   *-- If so, do nothing.  
*-- See if the desired table is currenly open
CASE SELECT("myTable") > 0
   *-- If yes, select it
   SELECT myTable
OTHERWISE
   *-- If no, open it
   USE myTable
ENDCASE

IF ALIAS() # myTable
   *-- Table did not open
   MESSAGEBOX("Table "+myTable+" did not open")
ELSE
   GOTO myRecordNumber 
   REPLACE myLogicalField WITH .t.
ENDIF

*-- Reslect the formerly selected table
IF NOT_EMPTY(lcOldSelect)
   SELECT (lcOldSelect)
ENDIF

RETURN
If I have misunderstood your inquiry, please let me know

Regards,

JME
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform