J
John Bishop
I have been poring over the built-in Help files for MS Access 2000, VBA and
various online help facilities for hours and frankly my head is spinning. I
see a wide variety of solutions to many complex problems, but I seem to be
unable to get any traction with the VBA code necessary to accomplish the
very simplest of tasks. Access and VBA are so "feature rich" and the
programming alternatives are so many and varied that I cant seem to gain the
grasp of how to take the very first step.
Suppose that I have a MS Access database called "Test.mdb" containing a
single table called "TestTable", which table contains three fields called
TxtField1, TxtField2 and NumField3. This database contains n existing
records with valid useful data for TxtField1 and TxtField2.
I now want to populate each and every record of TestTable with a value for
NumField3. I already have a working function that calculates the value to
be inserted. For the sake of simplicity here, suppose that I merely wanted
to set the value of NumField3 for each record to a certain constant, for
example "10.5". The text values of the other fields are to remain
unaltered.
What code would be necessary to open this table, to sequence through the
records and update only the value of the single field NumField3 to 10.5 for
each record.
(Obviously, this is trivial to do using simply a Query, but a Query will not
give the correct individual values to each element using the function I
intend to use to actually populate the Table.)
I sure that I must seem to be a DUNCE, but I think that if I could simply
see a simple example as to how to accomplish the task described above, I
would be away to the races producing useful code!
various online help facilities for hours and frankly my head is spinning. I
see a wide variety of solutions to many complex problems, but I seem to be
unable to get any traction with the VBA code necessary to accomplish the
very simplest of tasks. Access and VBA are so "feature rich" and the
programming alternatives are so many and varied that I cant seem to gain the
grasp of how to take the very first step.
Suppose that I have a MS Access database called "Test.mdb" containing a
single table called "TestTable", which table contains three fields called
TxtField1, TxtField2 and NumField3. This database contains n existing
records with valid useful data for TxtField1 and TxtField2.
I now want to populate each and every record of TestTable with a value for
NumField3. I already have a working function that calculates the value to
be inserted. For the sake of simplicity here, suppose that I merely wanted
to set the value of NumField3 for each record to a certain constant, for
example "10.5". The text values of the other fields are to remain
unaltered.
What code would be necessary to open this table, to sequence through the
records and update only the value of the single field NumField3 to 10.5 for
each record.
(Obviously, this is trivial to do using simply a Query, but a Query will not
give the correct individual values to each element using the function I
intend to use to actually populate the Table.)
I sure that I must seem to be a DUNCE, but I think that if I could simply
see a simple example as to how to accomplish the task described above, I
would be away to the races producing useful code!