>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
LOCAL lcOldSelect
lcOldSelect = ALIAS()
DO CASE
CASE lcOldSelect = myTable
CASE SELECT("myTable") > 0
SELECT myTable
OTHERWISE
USE myTable
ENDCASE
IF ALIAS() # myTable
MESSAGEBOX("Table "+myTable+" did not open")
ELSE
GOTO myRecordNumber
REPLACE myLogicalField WITH .t.
ENDIF
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.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.