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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding incremented values to a table 1

Status
Not open for further replies.

teach314

Technical User
Jul 29, 2011
183
CA
greetings

What is the best way in VBA to move down a column until the first null is encountered? (this isn't necessarily the last record in the table).

I'm using the following code now. It works fine, but it seems an inefficient method in very large tables. For example, I might have to move down 500,000 records before I find an 'absent' value of "Test".

...
rs.MoveFirst
Do While Not IsNull(rs("Test"))
rs.MoveNext
Loop
... .Edit / .Update code here to assign a value of "Test"

much thanks, teach314
 
What about this ?
rs.FindFirst "Test Is Null"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi PHV - I've tried many variations of your response, but I keep getting the error message... "Operation is not supported for this type of object". I may just be missing the correct syntax.
 
hi PHV - your solution works great. I kept getting an error message at first, but the fix was to add the constant 'dbOpenDynaset' to the statement 'Set rs = db.OpenRecordset("TblX", dbOpenDynaset)'. Not really sure why, but now it works fine!

Teach314
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top