Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Doesn't Save

Status
Not open for further replies.

StacyStacy

Programmer
Apr 16, 2003
60
US
After I created my frontend, I started to enter data. I even hit the save button. When I close out and reopen the db again, the data disappeared. Why has this happened? Please help.

Thanks,
 
Stacy,
Please provide more information. What version of FoxPro for Windows or FoxPro for DOS are you using? (e.g. FP 1.0, 1.1, 1.2, 2.0, FPW 2.5b, 2.6a, FPD 2.5b, FPD2.6a.)

How did you create this "frontend"? With the application builder, your own code, a 3rd party framework?

How are you entering this data? Are the table fields connected to the screen, or are you using memory variable? Are you using SCATTER/GATHER or REPLACE?

Rick
 
In addition to Rick's questions, what is the code behind your
"save button" (your Button's Valid code)?

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Thanks for helping me ...

1. I am using FoxPro 2.6.

2. I created the frontend thru Foxpro 2.6, creating a screen, saving my own environment, creating buttons that I've created my code own code. Additionally, I have setup code on on screen layout. Here's the code:
SET CENTURY ON
wasdel=SET("DELETED")
SET DELETED ON
IF !USED("bashproc")
USE bashproc IN 0
ENDIF
SELECT bashproc
SCATTER MEMVAR MEMO
m.newrec=.F. &&.F. means editing... .T. means new record.....

Here's the code under cleanup procedures:

* Restore deleted setting to its original value......
SET DELETED &wasdel

Here's the code on "activate window"
SHOW GET m.doit ENABLE &&navigation buttons
SHOW GET m.go,1 ENABLE &&add button
SHOW GET m.go,2 ENABLE &&save button
SHOW GET m.go,3 DISABLE &&delete button
SHOW GET m.go,4 ENABLE &&cancel button
SHOW GET m.go,5 ENABLE &&Quit button

3. I am entering data via the fields that are connected into the screen.

4 Yes, I am using memory variables that are scattered only.

5. Here's the code behind the "save" button:
CASE m.go = 2 &&save the new record
SELECT bashproc
IF m.newrec=.T.
APPEND BLANK
ENDIF
GATHER MEMVAR MEMO
_curobj=OBJNUM(m.task)
SHOW GETS
RETURN

Thanks a million!
 
Has the blank record been appended?

Does the number of records increase by 1?

Do you have a duplicate of an existing record? This could happen if you are editing database fields in your form rather than m.vars
 
If I add another record, by clicking onto the add button. Here's the code for the add, delete, cancel & exit buttons:

DO CASE

* This button will ADD a record
CASE m.go = 1
m.newrec=.T.
SELECT bashproc
* APPEND BLANK
SCATTER MEMVAR BLANK MEMO
_curobj=OBJNUM(m.task) &&like set focus in access......
SHOW GET m.doit DISABLE &&navigation buttons
SHOW GET m.go,1 DISABLE &&add button
SHOW GET m.go,2 ENABLE &&save button
SHOW GET m.go,3 ENABLE &&delete button
SHOW GET m.go,4 ENABLE &&cancel button
SHOW GET m.go,5 DISABLE &&Quit button


SHOW GETS &&refreshes the items on screen
RETURN

CASE m.go = 2 &&save the new record
SELECT bashproc
IF m.newrec=.T.
APPEND BLANK
ENDIF
GATHER MEMVAR MEMO
_curobj=OBJNUM(m.task)
SHOW GETS
RETURN


* This button will DELETE a record
CASE m.go = 3
IF l_yesno("Delete this record?",2)=1
DELETE
ELSE
WAIT WINDOW "Did not delete record....."
ENDIF
SKIP
IF EOF()
SKIP -1
ENDIF
SCATTER MEMVAR MEMO
SHOW GETS
RETURN

* This button will CANCEL a record
CASE m.go = 4
SHOW GET m.doit ENABLE &&enable nav buttons
SHOW GET m.go,1 ENABLE &&add button
SHOW GET m.go,2 DISABLE &&save button
SHOW GET m.go,3 ENABLE &&delete button
SHOW GET m.go,4 ENABLE &&Quit button
SHOW GET m.go,5 ENABLE &&cancel button

SCATTER MEMVAR MEMO
SHOW GETS
RETURN

*This button will exit the program
CASE m.go = 5
CLOSE DATA
CLEAR READ

ENDCASE
 
Stacy,
I have had similar problems on Win2k & WinXP machines. Make sure that in the disk drive properties, policies tab, the write caching is disabled. You might also issue a FLUSH command after the GATHER.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top