1

Re: Update Last Key

I have added a new table to our NBNData database, the first of a few which I am intending to use to hold certain types of Wildlife Sites data. For various reasons I would like to add the table as a new row in LAST_KEY so I can better track the primary key field, which is of the same type as other Recorder tables.

No problem adding it to the table, but I cannot see what else I need to do to ensure that the Update Last Key addin can see it and update the Last_key table accordingly. Is this possible and if so how is it done?

Rob Large
Wildlife Sites Officer
Wiltshire & Swindon Biological Records Centre

2

Re: Update Last Key

I am not sure how the addin identifies which tables are to be updated., but I don't think it is being present in the LastKey table  which is driving it. This is because  if a standard table is missing from the LastKey table then the addin will insert the table.

You could use a Batch Update or SQL batch  to update the LastKey table for your additional tables.
You would need one entry for each of your new tables something on the lines of the following, substituting 'NewTable' with the name of each of your additional tables.

Update Last_Key set  Last_key_Text =(SELECT RIGHT( MAX(NewTable.NewTableKey),8) FROM NewTable WHERE
left(NewTable.NewTableKey,8) = (SELECT DATA FROM SETTING WHERE NAME = 'SITEID')) WHERE LAST_KEY.TABLE_NAME =
'NewTable'

This assumes though that you have already added the tables names into Last_Key

Mike Weideli

3

Re: Update Last Key

No you are right, just being present in the last_key table doesn't cause the addin to do anything. I was hoping that there would just be a simple way to add the new table to what the addin does.

Not to worry though it isn't essential, my code should keep that table updated proerly anyway. It just would have been nice to have the addin working as an extra precaution.

Rob Large
Wildlife Sites Officer
Wiltshire & Swindon Biological Records Centre