To edit data in an Access table there needs to be a unique (usually primary) key to identify the row (record) to be changed. This is to be able to provide a WHERE clause that will apply only to that row in an SQL UPDATE.
Toedit data, read the data in the normal way, keeping track of the unique key. Any changed values can later be written to the same row using an UPDATE query with a WHERE clause.
Function SQLUpdate
INT hSQL, iResult;
hSQL = SQLConnect("DSN=ODBCTest;UID=YourUID;PWD=YourPWD");
IF hSQL <> -1 Then
iResult = SQLExec(hSQL, "UPDATE tblRecipes SET Flour = 20, Water = 30,Cocoa = 40 WHERE Recipe = 'X1234'");
SQLDisconnect(hSQL);
END
END
Note: The ODBC/SQL environment does not let
you edit the "Current Record" (there is no current record).
Consequently you cannot use DevAppend
or DevSetField
to add or modify records.
See Also