Understanding Codes

B

BeccySmith

I have got the following code in a database someone else
designed. I'm not sure what all the function actually
do. Can anyone help? I am having problems around the
Index statement and the EOF statement in particular.

Function wl_update_nonres2()

Dim wait As Database, wl As Recordset, prov As Recordset
Set wait = DBEngine.Workspaces(0).Databases(0)
Set wl = wait.OpenRecordset("WL NonRes Test")
Set prov = wait.OpenRecordset("Provider Codes")

wl.Index = "Provider"
wl.MoveFirst
Do Until wl.NoMatch
wl.Seek "=", Null
If Not wl.NoMatch Then
site = wl![prov_code]
prov.MoveFirst
While Not prov.EOF
If site = prov![site_code] Then
PRV = prov![prov_code]
End If
prov.MoveNext
Wend



wl.Edit
wl![provider] = PRV


wl.Update
End If
wl.MoveNext
Loop
End Function
 
A

Alex Dybenko

first it serach where field of Provider idex is null, then lookup prov_code
into Provider Codes query (Table)
and update provider field of "WL NonRes Test" to this value

i think if both queries are updateble - then better to use one update query
instead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top