>Now my code is like this, but still no effect. Isn't that strange?
>
>**************************************************************************
>
>CREATE SQL VIEW view5 AS SELECT &m_selectvelden FROM ALLTRIM(m_dbf2) WHERE SUBSTR(postcode, 1, 2) = ThisForm.cmbpostcode.DisplayValue
>
>USE view5
>=DBSETPROP('view5.uniekid','Field','KeyField',.T.)
>=DBSETPROP('view5.uniekid','Field','UpDatable',.F.)
>
>SELECT velden
>GO TOP
>DO WHILE NOT EOF()
> m_objectnm1 = 'view5.' + ALLTRIM(LOWER(veldnaam))
> m_veldnaam = ALLTRIM(LOWER(veldnaam))
> SELECT view5
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'UpDatable', .T.)
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'KeyField', .F.)
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'UpdateName', ALLTRIM(m_dbf2) + '.' + ALLTRIM(m_veldnaam))
> SELECT velden
> SKIP
>ENDDO
>
>=DBSETPROP('view5', 'View', 'Tables', ALLTRIM(m_dbf2))
>=DBSETPROP('view5', 'View', 'WhereType', 1)
>=DBSETPROP('view5', 'View', 'SendUpdates', .T.)
>
>SELECT view5
>
>** Inhere I change some data..............
>BROW
>
>TABLEUPDATE(.T.)
>
>** Then closing te view...
>IF INDBC(ALLTRIM(m_alias), 'TABLE')
> SELECT ALLTRIM(m_alias)
> USE
> FREE TABLE ALLTRIM(m_dbf)
>ELSE
> SELECT ALLTRIM(m_alias)
> USE
>ENDIF
>
>CLOSE DATABASES ALL
>USE ALLTRIM(m_dbf) EXCL
>PACK
>
>ThisForm.Release
>
>RELEASE ALL
>CLOSE ALL
>CLEAR EVENTS
Ron,
1) I don't see UpdateName entry for "uniekid". Though for a key field your intention might be set it to not updatable, include its updatename. Otherwise it doesn't update (maybe a bug I don't know, it's the case with SPT and I think same would apply to views as well).
2) "CREATE SQL VIEW view5 AS SELECT &m_selectvelden FROM ALLTRIM(m_dbf2) WHERE SUBSTR(postcode, 1, 2) = ThisForm.cmbpostcode.DisplayValue"
The definition of view is weird and makes me think that you're creating an updatable view on the fly. A view is stored in a dbc (yet another table) and if I'm right in my suspicion then you'd end with an ever growing dbc. Hopefully I'm wrong, otherwise think of alternatives like making parts of it parametric instead of hardcoding like that.
Cetin