
HELP - VB PRO /ACCESS 2.0 READ ACCESS ONLY mystery
Quote:
>Hi! I've coded a number of VB3.0 / ACCESS 2.0 apps with no problem. The
>current app I'm working on is giving me some grief though. I;m running
>the 2.5 Jet Engine with a small database. I'm using multiple inner
>joins. Somehow during development runs the access to the database gets
>switched to READONLY. I have no code to my knowledge that is doing this.
> I'm not using any data controls...everything is done with code. I open
>the database with the statement SET DB = OPENDATABASE(DBX,0,0) where DBX
>is a database name passed on the command line. If anyone has experienced
>a similar problem please reply.
> Thanks in advance.
> Steve
Question: You use multilpe inner joins, so is it possible that you have
a one to many relationship going here that will disallow updates? This
really applies to Dynasets, but sometimes we forget the difference.
When created from joins, a Dynaset has to follow these rules to be updatable:
1.) The Select statement must include DISTINCTROW. This causes the set
returned to include each row in which any of the values of all fields
in each table differs.
2.) If joined on a many-to-one (one-to-many) relationship, Select
Distinctrow statement can't include any field from the table that
represents the "one" side of the relationship.
3.) The table that represents the "one" side of the many-to-one (or vice
versa) relationship must have a primary key or unique index.
4.) The query cannot contain any self-join, include totals, or be a
crosstab query.
So, if you did one of those, that's probably the problem. The dynaset
created will automatically not be updatable. If you were to save this
dynaset into a table, the table might inherit that also (don't really know).
I had just passed a discussion of this in one of my books, and it didn't
mention what would happen in this case.
Hope this helps,
Michael