Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReNumber only specified records, not all 1

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
Here is the code I am using to renumber all the records in a table from 1 to the number of records, and it is working fine.

Set WS = DBEngine.Workspaces(0)
Set MyDb = WS.OpenDatabase("C:\Program Files\DailyABS\WindJob.mdb")
Set MySet = MyDb.OpenRecordset("ABS_Daily")
Auto = 1
MySet.MoveFirst
Do Until MySet.EOF
MySet.Edit
MySet("Auto") = Auto
MySet.Update
Auto = Auto + 1
MySet.MoveNext
Loop
MySet.Close: MyDb.Close: WS.Close

I would now like to modify this to only renumber the records that meet a certian condition.

The condition would be: Where Wound = 0

But I can't find the appropriate Select statement to make this If condition happen in MSAccess 2000.

Thanks for any input to my problem.
 
How about:

[tt]Set MySet = MyDb.OpenRecordset("Select * From ABS_Daily Where Wound=0")[/tt]
 
That's the ticket. Thank you so much, have a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top