Loop table rows in Access, with or without Private Const

Here I am programming VBA and I have Private Const with two elements:

 Private Const myList as String = "foo;bar" 

Then I have a loop structure like this:

 myTerms = Split(myList,";") For I = 0 to UBound(myTerms) 'do stuff in here Next I 

Finally, here is the new part. There are 100 different lines in tblWords consisting of just an identifier field and a text field such as tblWords.ID and tblWords.Word .

My question is: instead of using the Private Const loop and the loop twice, how can I change my loop so that it instead tblWords 100 times, once for each line?

+2
source share
1 answer

I think you mean

 Dim rs As DAO.Recordset Dim db As Database Set db = CurrentDB Set rs = db.OpenRecordset("tblWords") Do While Not rs.EOF sid = rs!ID sword = rs!word ''And to change a word rs.Edit rs!Word = rs!Word & " edited" rs.Update rs.MoveNext Loop 
+3
source

Source: https://habr.com/ru/post/1201690/


All Articles