473,505 Members | 15,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

looping through records and updating specific records

RC
My code below will loop through all the records in the table, and when
the if statement is true it goes to the
***Me.ContainerNumberProductsTable = GETContainerNumber.Value*** bit
like should but it does not make the change/update in the table. Any
ideas?
Dim rst As Object
Set rst = Me.Recordset.Clone
If Not rst.EOF Then Me.Bookmark = rst.Bookmark
varKeepGoing = [PalletNumberContainerFormComboBox]
Dim Found As Boolean
Do While Not rst.EOF
If rst("PalletNumberProductsTable") = varKeepGoing Then
Me.ContainerNumberProductsTable = GETContainerNumber.Value
End If
rst.MoveNext
varKeepGoing = [PalletNumberContainerFormComboBox]
Loop
If Not Found Then
msgbox "No Match Found"
End If
Nov 13 '05 #1
6 4615
RC wrote:
My code below will loop through all the records in the table, and when
the if statement is true it goes to the
***Me.ContainerNumberProductsTable = GETContainerNumber.Value*** bit
like should but it does not make the change/update in the table. Any
ideas?
Dim rst As Object
Set rst = Me.Recordset.Clone
If Not rst.EOF Then Me.Bookmark = rst.Bookmark
varKeepGoing = [PalletNumberContainerFormComboBox]
Dim Found As Boolean
Do While Not rst.EOF
If rst("PalletNumberProductsTable") = varKeepGoing Then
Me.ContainerNumberProductsTable = GETContainerNumber.Value
End If
rst.MoveNext
varKeepGoing = [PalletNumberContainerFormComboBox]
Loop
If Not Found Then
msgbox "No Match Found"
End If


Not sure what you're trying to do here but if you're trying to update
the recordset then the following points may help.

1) you should assign a value to one of the recordset's fields, e.g.
rst!FieldName = blahblah
2) If it's a DAO recordset you need rst.Edit to start the update (not in
ADO)
3) In both DAO and ADO you need a rst.Update to finish updating the
recordset.
--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #2
Trevor Best <nospam@localhost> wrote:
2) If it's a DAO recordset you need rst.Edit to start the update (not in
ADO)


The whole DAO/ADO thing is a bit over my head but AIUI A97 uses DAO but
A2003 uses ADO - that right? That being the case, if I convert an app from
A97 to A2003 are my rs.Edit instructions no longer required and, more
importantly, will leaving them there do any harm?

Or have I completely misunderstood the whole concept? ;o)
Nov 13 '05 #3
"Keith Wilby" <ke*********@AwayWithYerCrap.com> wrote in message
news:Xn************************@10.15.188.42...
Trevor Best <nospam@localhost> wrote:
2) If it's a DAO recordset you need rst.Edit to start the update (not in ADO)
The whole DAO/ADO thing is a bit over my head but AIUI A97 uses DAO but
A2003 uses ADO - that right? That being the case, if I convert an app

from A97 to A2003 are my rs.Edit instructions no longer required and, more
importantly, will leaving them there do any harm?

Or have I completely misunderstood the whole concept? ;o)\


You've misunderstood "some" of the concept. The differences relate to what
libraries are referenced *by default in a new project*.

If you convert an A97 file that uses DAO to a newer version it will still
reference and use DAO in the newer version and none of your syntax need
change. It is when you create *brand new* files that DAO will not be
referenced by default in A2000 and A2002. A2003 actually references BOTH
ADO and DAO by default so you have to remove one of them or make sure you
use unambiguous syntax for objects that exist in both ADO and DAO.

DAO.Recordset instead of just Recordset (for example)
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Nov 13 '05 #4
RC
I figured out a way to loop through the records in VBA code and update
specific records but it was extremely slow. The solution: I added the
single line of SQL code below to the AfterUpdate event for the
GetPalletNumberBox combo box on Form1. It works perfectly and lightning
fast. It takes the number in Text3 and puts that number in the
ContainerNumber column in Table1 for each record where the PalletNumber
column matches the number in the GetPalletNumberBox on Form1.

DoCmd.RunSQL ("UPDATE Table1 SET Table1.ContainerNumber =
[Forms]![Form1]![Text3] WHERE
(((Table1.PalletNumber)=[Forms]![Form1]![GetPalletNumberBox]));")

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
"Rick Brandt" <ri*********@hotmail.com> wrote:
Or have I completely misunderstood the whole concept? ;o)\
You've misunderstood "some" of the concept. The differences relate to
what libraries are referenced *by default in a new project*.


Only some? ;-)

If you convert an A97 file that uses DAO to a newer version it will
still reference and use DAO in the newer version and none of your
syntax need change. It is when you create *brand new* files that DAO
will not be referenced by default in A2000 and A2002. A2003 actually
references BOTH ADO and DAO by default so you have to remove one of
them or make sure you use unambiguous syntax for objects that exist in
both ADO and DAO.
Understood.

DAO.Recordset instead of just Recordset (for example)


Now that's very useful to know, I'll need to apply that by the looks of it.
Thanks again.
Nov 13 '05 #6
Keith Wilby wrote:
DAO.Recordset instead of just Recordset (for example)

Now that's very useful to know, I'll need to apply that by the looks of it.
Thanks again.


And "DAO.Recordset" notation is really useful when posting code to
usenet to save some poor guru babbling on about one way when the poster
is doing the other :-)

--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2081
by: RC | last post by:
I have a table that lists many box numbers. Each box number has a Pallet Number (indicating which pallet the box is in). When the Pallets are loaded into a shipping Container I need to update the...
4
1993
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
4
1669
by: Stinky Pete | last post by:
Hi, In order to keep the file that's in development up to date with the reference (and still used) file, I need to regularly import the original main table and then physically select and append...
1
1876
by: mkmkmkmk | last post by:
Hi, I've a table with fields name, date of format(hr:min:sec month day, year) I'm in search of a query that displays records group by records of same date. Please help
16
2404
by: mim77 | last post by:
Hi, I'm very rusty with Access programming. I hope someone can help me. I'm trying to include a count of the number of specific records in a field. Values for the records in the field are either...
2
1391
by: KMEscherich | last post by:
Using Access 2003 Hi there, can someone please tell me how I can give someone an option of entering 1 or two parameters or get all records??? 1) I would like to have an option of selecting...
3
3714
by: Okonita via DBMonster.com | last post by:
Hi all, Working on a little shell script to remove specific records from a flat file. I have scanned a one or two script books and googled for answers but have no success. Can someone show me how...
1
3608
WyvsEyeView
by: WyvsEyeView | last post by:
I have a dataset subform on which I want to lock a field for just two specific records. Each record has a type_id and a desc field. I want to test the value of the type_id field for the current...
0
7307
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
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7478
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...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.