Coding input of data onto a table

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hello,

I have a form on which, when the user updates a
particular 'price' field, I want to pass this new value
alwell as the entry in the current ID field into a raw
data table, to form a sort of "historical price log"
(which is for reporting purposes only and so does not need
it's own form).

Using Access code I have so far been able to pass the
values of the two fields into stored variables on exit of
the price control once the user has updated the price. I
can open the raw data table and goto a new record. But
when I say something similar to "PriceField =
StoredVariable" I get the error message "Cannot update
field".

I have made sure the two types of variables I am passing
values into are the same as the types in the raw data
table.

Is there a standard peice of code that inputs data into a
data table?

Thank you for any help you may be able to give.

Mark
 
Thank you for your reply.

I have considered it but couldn't fathom how you would get
the price and id fields of the current record that is
shown on the form to be the results of the query. Any
advice on how this can be done?
 
Mark

Check Access HELP for the syntax of the SQL statement for an append query
.... along the lines of:

SELECT YourID, YourField
INTO YourTable...

You could add code to your form (perhaps in the AfterUpdate event of the
YourField) that writes the data directly to the table.
 
Now...I'm not being funny - but wasn't that exactly what I
was asking how to do in the first place?

I can't find help in the help files which is why I'm on
this site.

I would love to "add code to your form (perhaps in the
AfterUpdate event of the YourField) that writes the data
directly to the table" but it's writing the data into the
table once I have placed it in stored variables that is
the problem.

-Do you know how I can add data to a new record in a table
using access code?

I get the error message "Cannot Update Field".

Thank you

Mark
 
Mark

Help me understand. Tell me again why you are passing values to variables.
You call them "stored variables" -- where do you currently store them?

Perhaps if you described more what you are trying to accomplish -- your
description seems to focus on the "how"...
 
Back
Top