ajetrumpet
Banned
- Local time
- Today, 13:47
- Joined
- Jun 22, 2007
- Messages
- 5,638
Folks,
I have this code:
I am getting an error "object invalid or no longer set" on the line in red. I have also tried this method of code to accomplish the same thing:
With this code I get the exact same error, again on the line in red. I have used the second method before, and it worked fine, but the only difference was that I was creating a tabledef instead of setting one that already existed in the database as a table. I am lost on this. Can someone shed some light on why I am getting this error? Thanks!
I have this code:
Code:
Dim tbldef As TableDef, rs As Recordset, rsOLD As Recordset,
myemail As String, fld As Field
Set tbldef = CurrentDb.TableDefs("ContactCheckListTable")
[COLOR="Red"]Set fld = tbldef.CreateField("contact", dbBoolean)[/COLOR]
With tbldef
.Fields.Append fld
End With
Set tbldef = Nothing
Code:
Dim tbldef As TableDef, rs As Recordset,
rsOLD As Recordset, myemail As String
Set tbldef = CurrentDb.TableDefs("ContactCheckListTable")
With tbldef
[COLOR="red"].Fields.Append .CreateField("contact", dbBoolean)[/COLOR]
End With
Set tbldef = Nothing
Attachments
Last edited: