>In my table I am setting the default value of the field for my primary key with an incremented value from a table that contains the listing of my tables (if that makes any sense). There is a field in that table that holds the last key for the table it corresponds to.
>
>My question is: how in my procedure to set the key do I know the name of the table I am inserting into to be able to pass it to the procedure. The procedure has to look up the table and increment the number then return it to me inside my field.
>
>I can't seem to find this information. I am sure it is probably something simple I am overlooking.
>
>Thanks for any help.
In your GetNextID routine you can have this code:
lparameter tcTable
if empty(tcTable) or vartype(tcTable)<>"C"
local lcAlias
lcAlias=alias()
if empty(lcAlias)
return .f.
else
tcTable=juststem(dbf(lcAlias))
endif
endif
If it's not broken, fix it until it is.
My Blog