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

INSERT -SQL problem VFP7 1

Status
Not open for further replies.

tonedef

Programmer
May 24, 1999
64
US
I'm having a strange problem inserting values into a table from code in a form. Inside a button on my form I update values in one table and that works fine. Right after that I perform an insert statement on another table and it doesn't give any errors (compile or run) yet it doesn't insert into the table.

The following is the insert statement in question:
[tt]
INSERT INTO costs(costid, caseid, dateentered, costtype, baseamount, numtimes, totalamount) VALUES(laNextCostID[1], thisform.caseid, DATE(), "REC", thisform.pgfCostWizard.pagBase.txtreceiving1.Value, null, thisform.pgfCostWizard.pagBase.txtreceiving1.Value)
[/tt]
I stopped the code here in the debugger to check values and then typeded the statement in the command window using the values and it worked fine.
[tt]
INSERT INTO costs(costid, caseid, dateentered, costtype, baseamount, numtimes, totalamount) VALUES(31, 1, DATE(), "REC", $ 9.0000, null, $ 9.0000)
[/tt]
Any thoughts would be appreciated,

tone
 
If you are doing table buffering then you need to do tableupdate().

If you created the view from the view designer then you need to check the updatetable checkbox
If view create programaticly the use cursorsetprop() to make view updateable.

Does your data enviroment fit any of the above? Attitude is Everything
 
Hi tonedef,

It is likely that something is wrong with your insert statement. One thing you might check is to be sure there are no variable type mismatches. For example, you might be using a character value from the form that is using a numberic format or inputmask. Although the value may appear numeric, if you used the builder to check it, you might find that it is actually a character value. If the underlying table field to which the form value is bound is defined as numberic or currency, this could cause the insert to fail. I would look over the insert statement very carefully until I found why it was failing.
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Thanks danceman,

TABLEUPDATE() did the trick! I would have pounded my head off my desk for days before I looked at table buffering.

Thanks again,

tone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top