setvalue problem

L

lerikson

I haven't used Access in a while. Currently, I have version 2003.
Anyways, I am running a test to do a simple macro that sets the value of a
single field in a table with only one field. The macro looks like this:
OpenTable
GoToRecord (New)
GoToControl (Field I want to update)
SetValue (I just put =14 for the test)

The table opens, the focus goes to the correct control, but then the value
does not get updated. I checked that I am in "add" mode, and I am. What am
I doing wrong?

Also, if I add GoToRecord (Next) at the end of the Macro, I get an error
that says I can't go to that record.

Is this a bug?
 
S

Steve Schapel

Lerikson,

You would not normally use SetValue in this way. You do not normally
work directly with data in tables. I don't know if what you are trying
will work, as I have never tried it. Normally you would use SetValue in
the context of a control on a form. In that case, there is no need for
a GoToCOntrol action in the macro. This is defined in the Item argument
of the SetValue action. So I am not sure where you put this 14 and what
else you put in the macro. And probably only of academic interest, and
of no practical use.

As for the GoToRecord, if you are already at a New record, then there is
no such thing as the Next record.

What you need to look at for this type of procedure is an Append Query
or an Update Query, to either add a new record or modify the data in an
existing record. And then if you want to automate it, you would do so
via an OpenQuery action in your macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top