I have made a lookup table containing for each suburb its old Suburb_ID (OSID) and the new one (NSID).
I have created a Sub to loop through the Address table, but I can't get the replacement to work. I tried a query in which the Address table and the Lookup table were linked, but that didn't work. My latest attempt uses a DLookup of the Lookup table, but that doesn't work either. Can anyone suggest a better way?
PS. Here is the code for my latest attempt. The address table is called "Venues" and the lookup table is called "ConvertSuburbID".
Expand|Select|Wrap|Line Numbers
- Private Sub Command0_Click()
- Dim rs As DAO.Recordset, TempID As Long
- Set rs = CurrentDb.OpenRecordset("Venues")
- If Not (rs.EOF And rs.BOF) Then
- rs.MoveFirst
- Do Until rs.EOF = True
- rs.Edit
- TempID = rs!Suburb_ID
- rs!Suburb_ID = DLookup("NSID", "ConvertSuburbID", "OSID=TempID")
- rs.Update
- rs.MoveNext
- Loop
- Else
- MsgBox "There are no records in the recordset."
- End If
- rs.Close 'Close the recordset
- Set rs = Nothing 'Clean up
- End Sub