473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Read specific field of specific record

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
4 5485
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: datactrl | last post by:
Hi, all Is there any way to make a SELECT field in HTML as a read only field? Jack
2
by: RC | last post by:
I would like to go to a specific record based on what the user types in a text box on a form. I have a table named: Boxes in the table there is a field named: BoxNumber a form named: BxForm ...
0
by: kkrizl | last post by:
I'm having a very bizarre problem. I open up my table in datasheet view, and I click on edit, find. In the Find and Replace dialog box, I enter an address (123 main for example). If I set the...
1
by: coacalli | last post by:
Greetings from the 3rd world This is the thing, i have a table, records on it with fields each and every one of them. i need to figure uot a way to update one, and only one field per record...
3
by: jaymaelescent | last post by:
I have been asked by worklace to try and make a database for them, i have some experience but have encountered a problem making user specific reports. I need to make a report based on a person stored...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
5
by: theine | last post by:
How do I create Hyperlink based of a specific field in the same row? In Excel it done like this: =HYPERLINK("", A273) where the anything inside the " " is the value it's looking for in that...
1
by: sukatoa | last post by:
I still do the process of incrementing a specific field in a stand alone apps by query 1: get its value query 2: update value +1 But, i realize that this is really a bad idea when this would...
3
by: Ron Mowry | last post by:
I am wanting to create a macro that will fill a specific field on a form and then go to the next record set. I have a blank field in the table that the form is pulling from. I want the user to be...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.