the program listed below runs and does what I want it to when I DO NOT INCLUDE the 2 "close" statements, but it gives me a "Member Not Found" error when I include the lines "fld.close" and "tbl.close" . Can anyone tell me if I need these lines as a method of proper coding or have I used them improperly. I really want to understand how to code properly. Thank you for any help!!
Private Sub lstTableList_Af terUpdate()
Dim db As dao.Database
Dim tbl As dao.TableDef
Dim fld As dao.Field
Dim tblClientTable As String
tblClientTable = Forms!frmDailyC lient!lstTableL ist
Debug.Print tblClientTable & "tblclienttable "
mAnswer = MsgBox("Add a field called LS Data?", vbYesNo)
If mAnswer = 6 Then
Set db = CurrentDb()
Set tbl = db.TableDefs(tb lClientTable)
' Create field; set its properties; add it to the tabledef
Set fld = tbl.CreateField ("LSRate", dbDouble)
tbl.Fields.Appe nd fld
'fld.Close
'tbl.Close
Set fld = Nothing
Set tbl = Nothing
Set db = Nothing
End If
'Me!lstFieldLis t.Visible = True
'Me!lstFieldLis t.SetFocus
Me!lstTableList .Visible = False
End Sub
Private Sub lstTableList_Af terUpdate()
Dim db As dao.Database
Dim tbl As dao.TableDef
Dim fld As dao.Field
Dim tblClientTable As String
tblClientTable = Forms!frmDailyC lient!lstTableL ist
Debug.Print tblClientTable & "tblclienttable "
mAnswer = MsgBox("Add a field called LS Data?", vbYesNo)
If mAnswer = 6 Then
Set db = CurrentDb()
Set tbl = db.TableDefs(tb lClientTable)
' Create field; set its properties; add it to the tabledef
Set fld = tbl.CreateField ("LSRate", dbDouble)
tbl.Fields.Appe nd fld
'fld.Close
'tbl.Close
Set fld = Nothing
Set tbl = Nothing
Set db = Nothing
End If
'Me!lstFieldLis t.Visible = True
'Me!lstFieldLis t.SetFocus
Me!lstTableList .Visible = False
End Sub
Comment