General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Hi Hilmar
Simply call the UDF that assigns the primary key from the View's Default, not the table, you will need to make the Primary Key field updateable.
Bruce
>How should the following situation be handled?
>
>The primary key in a table is assigned through a function, through its default value.
>
>In a parameterized view (local view), the primary key field is marked as a primary field, and is not updatable. All other fields are updatable.
>
>When the user creates a new record (the datasource is the local view), and saves it, the table receives its PK correctly (through the default value), and all other fields get updated correctly. However, the PK in the view still has the value zero, since no data is returned from the view to the table. Therefore, if the user does changes to the newly created record, these changes can't be saved, since the PK is invalid. There are also a few other problems, related to the missing PK in the view.
>
>If, on the other hand, the user closes the form (the one that uses the p-view) and opens it again, the data is read correctly, and the record can be saved. Also, I might do a requery(); but it seems inefficient to requery() the entire set of data every time a single record is saved (only for new records). I thought there must be another way.
>
>I think there might be some bad design in the structure explained above, but I can't spot it.
>
>TIA,
>
>Hilmar.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only