By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

Read specific field of specific record

P: n/a
I'm attempting to build a module that will allow me to update one field of a
record (using a value from a previous record) based on the value of another
field in the same record. I can successfully "cycle" through the records
one at a time and get to the appropriate field as well, but any attempt to
read the field values (using SELECT, of DoCmd.RunSQL "SELECT....) result in
errors.

I've searched the help file and this newsgroup but haven't found an answer.

Any help greatly appreciated.

Thanx

Chuck
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Currentdb.execute "Update mytable set myfield = " & mystoredvalue & "where
MyIDfield = somevalue", dbfailonerror

It may need more/less quotes depending on datatypes.

Regards

Peter Russell
Chuck previously wrote:
I'm attempting to build a module that will allow me to update one field
of a
record (using a value from a previous record) based on the value of
another
field in the same record. I can successfully "cycle" through the
records
one at a time and get to the appropriate field as well, but any attempt
to
read the field values (using SELECT, of DoCmd.RunSQL "SELECT....)
result in
errors.

I've searched the help file and this newsgroup but haven't found an
answer.

Any help greatly appreciated.

Thanx

Chuck


Nov 12 '05 #2

P: n/a
Why a module and not an update query? It's usually easier just to design
such a query in the design grid, and then if you need to have it run in a
module paste the SQL text in. Jet will cycle through records much faster
than VBA.
"Chuck" <b2******@aol.com> wrote in message
news:Hn********@news.boeing.com...
I'm attempting to build a module that will allow me to update one field of a record (using a value from a previous record) based on the value of another field in the same record. I can successfully "cycle" through the records
one at a time and get to the appropriate field as well, but any attempt to
read the field values (using SELECT, of DoCmd.RunSQL "SELECT....) result in errors.

I've searched the help file and this newsgroup but haven't found an answer.
Any help greatly appreciated.

Thanx

Chuck

Nov 12 '05 #3

P: n/a
Thanx Peter,
This gets me part way there (at least in terms of my understanding). I
still don't know how to "remember" the value from a previous record
(mystoredvalue in your sample).

Taking baby steps, I guess...

Thanx again
Chuck

"Peter Russell" <ru***@127.0.0.1> wrote in message
news:me**********************@russellscott.btinter net.com...
Currentdb.execute "Update mytable set myfield = " & mystoredvalue & "where
MyIDfield = somevalue", dbfailonerror

It may need more/less quotes depending on datatypes.

Regards

Peter Russell
Chuck previously wrote:
I'm attempting to build a module that will allow me to update one field
of a
record (using a value from a previous record) based on the value of
another
field in the same record. I can successfully "cycle" through the
records
one at a time and get to the appropriate field as well, but any attempt
to
read the field values (using SELECT, of DoCmd.RunSQL "SELECT....)
result in
errors.

I've searched the help file and this newsgroup but haven't found an
answer.

Any help greatly appreciated.

Thanx

Chuck

Nov 12 '05 #4

P: n/a
Good question. I didn't know I could store a previous record's value for
use in updating a subsequent record within an update query. I'll have to
see how to make that happen.

Thanx much

Chuck

"Bruce Rusk" <ho**********@spamless.ucla.edu> wrote in message
news:bn**********@gladiola.noc.ucla.edu...
Why a module and not an update query? It's usually easier just to design
such a query in the design grid, and then if you need to have it run in a
module paste the SQL text in. Jet will cycle through records much faster
than VBA.
"Chuck" <b2******@aol.com> wrote in message
news:Hn********@news.boeing.com...
I'm attempting to build a module that will allow me to update one field of
a
record (using a value from a previous record) based on the value of

another
field in the same record. I can successfully "cycle" through the

records one at a time and get to the appropriate field as well, but any attempt to read the field values (using SELECT, of DoCmd.RunSQL "SELECT....) result

in
errors.

I've searched the help file and this newsgroup but haven't found an

answer.

Any help greatly appreciated.

Thanx

Chuck


Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.