Why does the code work for Grave D, but not for Grave E
I choose not to use SQL, I wanted to learn this way
Grave D spelling of field name as copied from same table in design mode with one space
Grave E spelling of field name as copied from same table in design mode with 2 spaces
Code:
Sub Debuger()
Dim Recset As Recordset
Set Recset = CurrentDb.OpenRecordset("Sheet1")
Dim Allnames As Recordset
Set Allnames = CurrentDb.OpenRecordset("allnames")
' access to Table Allnames
Dim Blanks As String
Blanks = " "
Dim x As Integer
x = 1
Allnames.MoveFirst ' P211
' Allnames.MoveNext
' Allnames.MoveNext
' MsgBox Allnames![aname] & " owner is"
Do Until Allnames.EOF 'P257 erase previous contents
Allnames.Delete
Allnames.MoveNext
Loop
'Allnames.Close
'Recordset = Nothing
MsgBox "CLEARED"
MsgBox Recset![GRAVE D] & " AT D"
If Recset![GRAVE D] > Blanks And Recset![GRAVE D] <> "DNA" Then
Allnames.AddNew ' record
Allnames![AName] = Recset![GRAVE D] ' copy field to Allnames table
Allnames![lot] = Recset![lot #]
Allnames![location] = "Grave D" ' name of field, not contents Recset![contact]
Allnames.Update
End If
MsgBox Recset![Grave E] ' Item not found in collection
If Recset![Grave E] > Blanks And Recset![Grave E] <> "DNA" Then
Allnames.AddNew ' record
Allnames![AName] = Recset![Grave E] ' copy field to Allnames table
Allnames![lot] = Recset![lot #]
Allnames![location] = "Grave E" ' name of field, not contents Recset![contact]
Allnames.Update
End If
End Sub