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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using screen/form table will not append 1

Status
Not open for further replies.

foamlady

Technical User
Mar 16, 2011
21
US
visual fox pro9

I have nothing fancy. One table that I want to add records to.
I must not have something right because nothing enters the table when I hit my command button with code of
append blank
entryscreen.refresh
my screen does come up clean for the next entry

My data enviroment shows the correct table and so does my data session. Should this be someplace else noted?

I also need the code for the exit button. When I leave the practice screen with the upper corner red x I get the message that changes have been do you want to save?

I appreciate everyone's help. I posted earlier on a more complicated set up, with time running out I gave up on it and went back to my "oldie" reentering it. Now I even more confused.
 
You should end up with a new, empty record each time you issue APPEND BLANK.

If you are NOT ending up with blank records, then you have buffering turned on but you're not committing the buffer before adding a new record.

If you ARE ending up with blank records, then you aren't properly binding controls to the form's fields.

Which is it? :)
 
when I append blank I get a clear screen ready to enter next record.

It does not post to my table.

How do I properly bind controls to the form's fields. My Control source in Properities reads "table name.field name"

 
This is a wild guess because you are not being very clear.

Before you APPEND BLANK, try:

TableUpdate(.t.)
 
As stated, the append only adds a new record. In your save you need to do a replace. I.E. replace firstname with thisform.txtFirstname.value or set the control source poperty on the text filed to equal tablename.firstname (for example). There are several other ways but this is a couple basic ways.



Jim
 
Dan, that wild guess worked!!

THANK YOU both for helping

Now what do I write for code for the Command Button to exit from my form/screen.
 
Glad it worked!

Put this as your exit button's code:

thisform.release()

HOWEVER, you'll probably want to do the tableupdate() there too.

It's actually a much larger topic, because there's an entirely different place to deal with clicking the close button in the upper right hand corner of the form.

If you want to handle that too, then we need to discuss ARCHITECTURE and how to build some into your application.
 
Generally an Exit or Quit button will have ThisForm.Release in its Click method.

This would cause the form to close in the similar manner as it does if the "X" were clicked.

However if you have other code that needs to be run before an Exit, then a call to that code (example: ThisForm.CloseCode ) would need to be in the method as well prior to the Release.

Good Luck,
JRB-Bldr
 
if you have other code that needs to be run before an Exit, then a call to that code (example: ThisForm.CloseCode ) would need to be in the method as well prior to the Release.

And call it from the QueryUnload as well. That way, it will also fire if the user hits the Close button (the "X" button) on the form's title bar.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top