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

Insert Record in a new Created Field

Status
Not open for further replies.

luistsousa

Technical User
May 12, 2003
66
PT
Hi

I have a table. In the program I have a button that add a field with editable name. I have another button that add a record to a field of table.
The problem is that when I select the new field that has been created in this session of the program, appears an error with the message of that the field does not exist.

To notice, that when I restart the program, I can insert records to this field. I think that is necessary make some update to the dates of table, but with refresh() don't work.

best Regards
 
Maybe you have to call ApplyUpdates first? You may have to then call Commit and CommitUpdates as well.

Also look at using Post().

Just some guesses!

Good luck,
Chris
 
HI

I have used this code. Don't work;

AnsiString new_field;
InputQuery("","",new_field);
AddFieldToDatabase("test",new_field, "CHAR(25)");
Table1->CommitUpdates();
Table1->Refresh();
Table1->ApplyUpdates();
Table1->Insert();
Table1->FieldByName(new_field)->Value="test1";
Table1->Post();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top