Morning All,
I hope someone can help me here...
I am trying to fill in the blanks within the records of a table using information already in that table.
i.e: I have five records with the same 'premise code' but only on has 'Tier' information - I want to be able to put this information in all 5.
I thought I had it with this code but when I run it Access just shuts down on me...program not responding.
Could someone have a look and maybe VET my code and tell what what simple thing I am missing.
---------------------------------------
--------------------------------------
Any help would be much appreciated
-----------
Comrades, What we do in life echoes in eternity
I hope someone can help me here...
I am trying to fill in the blanks within the records of a table using information already in that table.
i.e: I have five records with the same 'premise code' but only on has 'Tier' information - I want to be able to put this information in all 5.
I thought I had it with this code but when I run it Access just shuts down on me...program not responding.
Could someone have a look and maybe VET my code and tell what what simple thing I am missing.
---------------------------------------
Code:
Private Sub Tier_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strSQL2 As String
strSQL = "SELECT DISTINCT [Premise Code], Tier "
strSQL = strSQL & "FROM [Combined List] "
strSQL = strSQL & "WHERE Tier Is Not Null;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Do Until rs.EOF
strSQL2 = "UPDATE [Combined List] SET Tier='"
strSQL2 = strSQL2 & rs!Tier & "' WHERE [Premise Code]='"
strSQL2 = strSQL2 & rs![Premise Code] & "';"
db.Execute strSQL2
rs.MoveNext
Loop
End Sub
Any help would be much appreciated
-----------
Comrades, What we do in life echoes in eternity