Hi All
I am hoping to present the user with a msgbox at the end of an sql update query that advises which records were added. In order to do it I need to be able to add each row in a recordset to an array variable. Can anybody explain why the first piece of code works for me (msgbox each recipe individullly) but the second is a type mismatch:
Working
Set db = CurrentDb
Set rs = db.OpenRecordset("RECIPES")
For i = 0 To rs.RecordCount - 1
MsgBox rs.Fields("RecipeName")
rs.MoveNext
Next i
Type mismatch
Set db = CurrentDb
Set rs = db.OpenRecordset("RECIPES")
For i = 0 To rs.RecordCount - 1
arry(1) = rs.Fields("RecipeName")
rs.MoveNext
Next i
I am hoping to present the user with a msgbox at the end of an sql update query that advises which records were added. In order to do it I need to be able to add each row in a recordset to an array variable. Can anybody explain why the first piece of code works for me (msgbox each recipe individullly) but the second is a type mismatch:
Working
Set db = CurrentDb
Set rs = db.OpenRecordset("RECIPES")
For i = 0 To rs.RecordCount - 1
MsgBox rs.Fields("RecipeName")
rs.MoveNext
Next i
Type mismatch
Set db = CurrentDb
Set rs = db.OpenRecordset("RECIPES")
For i = 0 To rs.RecordCount - 1
arry(1) = rs.Fields("RecipeName")
rs.MoveNext
Next i