How to change table field value

  • Thread starter Thread starter kiki
  • Start date Start date
K

kiki

I need some basic answer for Access97

I need to update some specific field in one table after for example Form
On_Close Event. I don't know how to write a code which will add some value
to specific field in specified table.
Also if field does not exist in selected table to authomaticaly create it.

I have tried the following but Type Missmatch error occurs:

Dim dbs As Database
Dim tdf As TableDef
Dim fld As Field

Set dbs = CurrentDb()
Set tdf = dbs.TableDefs("Microwave")
Set fld = tdf.Fields("Far_RAUType")

fld = DLookup ("some expression....")

Thanks

Christian
 
It sounds very much like you are trying to store calculations in your
Access table. You cannot dio that, Access is not Excel and doesn't
have the recalculation tools of a spreadsheet. It has much more power
than excel, you just have to get to grips with the new concepts. The
main ones are Queries, Forms and subforms working together.

Calculations are either dynamically done in the Queries, Reports or
the Forms.

If you'd like mor information, ask away

Brett


I need some basic answer for Access97

I need to update some specific field in one table after for example Form
On_Close Event. I don't know how to write a code which will add some value
to specific field in specified table.
Also if field does not exist in selected table to authomaticaly create it.

I have tried the following but Type Missmatch error occurs:

Dim dbs As Database
Dim tdf As TableDef
Dim fld As Field

Set dbs = CurrentDb()
Set tdf = dbs.TableDefs("Microwave")
Set fld = tdf.Fields("Far_RAUType")

fld = DLookup ("some expression....")

Thanks

Christian

Cheers,
Brett
 
Hi Kiki,

It's not clear what you're trying to do, because "update some specific
field in one table" doesn't make sense in this context. You can update a
specific field in one or more records in a table, but you always have to
specify which records.

Also, if you find that you need to write code that adds fields to
tables, it's almost always a sign of fundamental problems in the design
of your database.

Would you like to explain in more detail what you're trying to achieve?
 
Back
Top