what does the TO field say on the email you're processing, the only thing I can think is that there's some character in there that the code doesn't like.
I don't understand why you would get the subject but bomb on the .to
maybe try it without the WITH statement
Code:
Dim olNS As NameSpace
Dim item As Object
Dim Inbox As MAPIFolder
Dim SubInbox As MAPIFolder
Set olNS = GetNamespace("MAPI")
Set Inbox = olNS.GetDefaultFolder(olFolderInbox)
Set SubInbox = Inbox.Folders("TEST")
Dim sSQL As String
For Each item In SubInbox.Items
If TypeOf item Is MailItem Then
'With item
Debug.Print item.subject
Debug.Print item.to
Debug.Print item.body
Debug.Print item.SenderEmailAddress
'if you get values in these debug.print statements you can move on to the SQL which in your example won't work
'DoCmd.RunSQL "INSERT INTO TEST(subject, to) SELECT '" & & "','" & .To & "'"
'End With
End If
Next item
Set ns = Nothing
Set olNS = Nothing
Set Inbox = Nothing
Set SubInbox = Nothing
Also, try switching the order of the debug.print statements, see if there are any others that are causing problems.
Also, try moving the debug.print .to or debug.print item.to to the first debug.print statement and see if maybe there's a problem after the first item is printed