Hi there!
I'm trying to create a new field in a table but I got a conversion type error in my code :
Is somebody can help me to solve that error ?
Thanks!
I'm trying to create a new field in a table but I got a conversion type error in my code :
Code:
[FONT=Courier]Public Sub add_field()[/FONT]
[FONT=Courier][COLOR=#008000]'I take the last sequential number from a table[/COLOR][/FONT]
[FONT=Courier] Dim idtt As Integer[/FONT]
[FONT=Courier] idtt = DMax("ID", "tbl_task")[/FONT]
[FONT=Courier] Dim db As Database[/FONT]
[FONT=Courier] Dim tbl As TableDef[/FONT]
[FONT=Courier] Dim fld As DAO.Field[/FONT]
[FONT=Courier] Set db = CurrentDb[/FONT]
[FONT=Courier] Set tbl = db.TableDefs("tbl_events")[/FONT]
[FONT=Courier] Set fld = tbl.CreateField(idtt, Text) 'Highlighted by the debugger[/FONT]
[FONT=Courier] tbl.Fields.Append fld[/FONT]
[FONT=Courier] db.Close[/FONT]
[FONT=Courier]End Sub[/FONT]
Is somebody can help me to solve that error ?
Thanks!